From f376520c3ee0913754ff6cfe270b09999a6888cf Mon Sep 17 00:00:00 2001 From: George M Dias Date: Wed, 20 Nov 2024 08:30:06 -0600 Subject: [PATCH] Removed deep diff tests Signed-off-by: George M Dias --- package-lock.json | 13 --- package.json | 2 - .../convert/hdf2ckl_deepCompare.test.ts | 90 ------------------- 3 files changed, 105 deletions(-) delete mode 100644 test/commands/convert/hdf2ckl_deepCompare.test.ts diff --git a/package-lock.json b/package-lock.json index 3621b2859..6122da094 100644 --- a/package-lock.json +++ b/package-lock.json @@ -45,7 +45,6 @@ "chai": "^4", "colors": "^1.4.0", "csv-parse": "^4.16.0", - "deep-diff": "^1.0.2", "dotenv": "^16.3.1", "express": "^4.17.3", "fast-xml-parser": "^4.2.7", @@ -92,7 +91,6 @@ "devDependencies": { "@e965/xlsx": "^0.20.0", "@oclif/test": "^4.1.0", - "@types/deep-diff": "^1.0.5", "@types/js-yaml": "^4.0.9", "@types/jsdom": "^21.1.7", "@types/mock-fs": "^4.13.4", @@ -7763,12 +7761,6 @@ "@types/pumpify": "*" } }, - "node_modules/@types/deep-diff": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/@types/deep-diff/-/deep-diff-1.0.5.tgz", - "integrity": "sha512-PQyNSy1YMZU1hgZA5tTYfHPpUAo9Dorn1PZho2/budQLfqLu3JIP37JAavnwYpR1S2yFZTXa3hxaE4ifGW5jaA==", - "dev": true - }, "node_modules/@types/duplexify": { "version": "3.6.4", "resolved": "https://registry.npmjs.org/@types/duplexify/-/duplexify-3.6.4.tgz", @@ -9983,11 +9975,6 @@ } } }, - "node_modules/deep-diff": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/deep-diff/-/deep-diff-1.0.2.tgz", - "integrity": "sha512-aWS3UIVH+NPGCD1kki+DCU9Dua032iSsO43LqQpcs4R3+dVv7tX0qBGjiVHJHjplsoUM2XRO/KB92glqc68awg==" - }, "node_modules/deep-eql": { "version": "4.1.3", "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-4.1.3.tgz", diff --git a/package.json b/package.json index a1a216fbb..d8e1d7085 100644 --- a/package.json +++ b/package.json @@ -42,7 +42,6 @@ "chai": "^4", "colors": "^1.4.0", "csv-parse": "^4.16.0", - "deep-diff": "^1.0.2", "dotenv": "^16.3.1", "express": "^4.17.3", "fast-xml-parser": "^4.2.7", @@ -86,7 +85,6 @@ "devDependencies": { "@e965/xlsx": "^0.20.0", "@oclif/test": "^4.1.0", - "@types/deep-diff": "^1.0.5", "@types/js-yaml": "^4.0.9", "@types/jsdom": "^21.1.7", "@types/mock-fs": "^4.13.4", diff --git a/test/commands/convert/hdf2ckl_deepCompare.test.ts b/test/commands/convert/hdf2ckl_deepCompare.test.ts deleted file mode 100644 index a5fe1f9db..000000000 --- a/test/commands/convert/hdf2ckl_deepCompare.test.ts +++ /dev/null @@ -1,90 +0,0 @@ -/* eslint-disable array-bracket-newline */ -/* eslint-disable array-element-newline */ -import {runCommand} from '@oclif/test' -import assert from 'assert' -import {diff} from 'deep-diff' -import fs from 'fs' -import path from 'path' -import tmp from 'tmp' -import {parseStringPromise} from 'xml2js' -import {removeUUIDs} from '../utils' - -describe('Test hdf2checklist - deep compare', () => { - const tmpobj = tmp.dirSync({unsafeCleanup: true}) - const logDir = './test/logs' - - beforeEach(() => { - // Check if the directory exists - if (!fs.existsSync(logDir)) { - // If it doesn't exist, create the directory - fs.mkdirSync(logDir) - } - }) - - it('hdf-converter output test - defaults', async () => { - await runCommand<{name: string}>(['convert hdf2ckl', - '-i', path.resolve('./test/sample_data/HDF/input/red_hat_good.json'), - '-o', `${tmpobj.name}/hdf2ckl_test.ckl`, - ]) - const test = fs.readFileSync(`${tmpobj.name}/hdf2ckl_test.ckl`, 'utf8').replaceAll(/\r/gi, '') - const sample = fs.readFileSync(path.resolve('./test/sample_data/checklist/red_hat_good.ckl'), 'utf8').replaceAll(/\r/gi, '') - - const testObj = await parseStringPromise(test) - const sampleObj = await parseStringPromise(sample) - - removeUUIDs(testObj) - removeUUIDs(sampleObj) - - const differences = diff(testObj, sampleObj) - - if (differences) { - fs.writeFileSync(`${logDir}/differences_hdf2ckl_defaults.json`, JSON.stringify(differences, null, 2)) - assert.fail(`Objects are not deeply equal - see ${logDir}/differences_hdf2ckl_defaults.json`) - } - }) - - it('hdf-converter output test - inspec results from profile with dependent profiles', async () => { - await runCommand<{name: string}>(['convert hdf2ckl', - '-i', path.resolve('./test/sample_data/HDF/input/vSphere8_report.json'), - '-o', `${tmpobj.name}/hdf2ckl_test.json`, - ]) - const test = fs.readFileSync(`${tmpobj.name}/hdf2ckl_test.json`, 'utf8').replaceAll(/\r/gi, '') - const sample = fs.readFileSync(path.resolve('./test/sample_data/checklist/vSphere8_report.ckl'), 'utf8').replaceAll(/\r/gi, '') - - const testObj = await parseStringPromise(test) - const sampleObj = await parseStringPromise(sample) - - removeUUIDs(testObj) - removeUUIDs(sampleObj) - - const differences = diff(testObj, sampleObj) - - if (differences) { - fs.writeFileSync(`${logDir}/differences_hdf2ckl_test.json`, JSON.stringify(differences, null, 2)) - assert.fail(`Objects are not deeply equal - see ${logDir}/differences_hdf2ckl_test.json`) - } - }) - - it('hdf-converter output test - with metadata', async () => { - await runCommand<{name: string}>(['convert hdf2ckl', - '-i', path.resolve('./test/sample_data/HDF/input/red_hat_good.json'), - '-o', `${tmpobj.name}/hdf2ckl_metadata_test.json`, - '-m', path.resolve('./test/sample_data/checklist/metadata.json'), - ]) - const test = fs.readFileSync(`${tmpobj.name}/hdf2ckl_metadata_test.json`, 'utf8').replaceAll(/\r/gi, '') - const sample = fs.readFileSync(path.resolve('./test/sample_data/checklist/red_hat_good_metadata.ckl'), 'utf8').replaceAll(/\r/gi, '') - - const testObj = await parseStringPromise(test) - const sampleObj = await parseStringPromise(sample) - - removeUUIDs(testObj) - removeUUIDs(sampleObj) - - const differences = diff(testObj, sampleObj) - - if (differences) { - fs.writeFileSync(`${logDir}/differences_hdf2ckl_metadata_test.json`, JSON.stringify(differences, null, 2)) - assert.fail(`Objects are not deeply equal - see ${logDir}/differences_hdf2ckl_metadata_test.json`) - } - }) -})