diff --git a/package.json b/package.json index 5a87d459..a1147eaf 100644 --- a/package.json +++ b/package.json @@ -3,25 +3,25 @@ "name": "firebolt-certification", "description": "Reference App to demonstrate Firebolt APIs and Lifecycle", "dependencies": { - "@apidevtools/json-schema-ref-parser": "^9.0.9", + "@apidevtools/json-schema-ref-parser": "9.1.2", "@firebolt-js/discovery-sdk": "1.7.0", "@firebolt-js/manage-sdk": "1.7.0", "@firebolt-js/sdk": "1.7.0", "@lightningjs/core": "2.11.0", - "@lightningjs/sdk": "^5.0.1", - "@lightningjs/ui-components": "^2.2.2", - "dotenv": "^14.2.0", + "@lightningjs/sdk": "5.5.6", + "@lightningjs/ui-components": "2.25.1", + "dotenv": "14.3.2", "enhanced-resolve": "5.12.0", - "eventemitter3": "^5.0.1", - "glob": "^8.1.0", - "glob-parent": "^5.1.2", - "json-schema-ref-parser": "^9.0.9", + "eventemitter3": "5.0.1", + "glob": "8.1.0", + "glob-parent": "5.1.2", + "json-schema-ref-parser": "9.0.9", "jsonschema": "1.4.1", - "perf_hooks": "^0.0.1", + "perf_hooks": "0.0.1", "rxjs": "7.2.0", - "uuid": "^9.0.0", + "uuid": "9.0.1", "winston": "3.15.0", - "xml2js": "^0.5.0" + "xml2js": "0.5.0" }, "overrides": { "winston": { @@ -39,24 +39,24 @@ "lint": "eslint ." }, "devDependencies": { - "@babel/plugin-transform-modules-commonjs": "^7.16.5", - "@babel/preset-env": "^7.16.5", - "babel-jest": "^27.4.5", - "clean-webpack-plugin": "^3.0.0", - "copy-webpack-plugin": "^5.0.4", - "eslint": "^8.48.0", - "eslint-config-prettier": "^9.0.0", - "eslint-plugin-import": "^2.28.1", - "eslint-plugin-prettier": "^5.0.0", - "file-loader": "^4.1.0", - "git-revision-webpack-plugin": "^3.0.6", - "html-webpack-plugin": "^3.2.0", - "http-server": "^0.11.1", - "jest": "^27.4.5", - "prettier": "^3.0.3", - "standard": "*", - "webpack": "^4.36.1", - "webpack-cli": "^3.3.6", - "webpack-dev-server": "^3.7.2" + "@babel/plugin-transform-modules-commonjs": "7.27.1", + "@babel/preset-env": "7.28.5", + "babel-jest": "27.5.1", + "clean-webpack-plugin": "3.0.0", + "copy-webpack-plugin": "5.1.2", + "eslint": "8.57.1", + "eslint-config-prettier": "9.1.2", + "eslint-plugin-import": "2.32.0", + "eslint-plugin-prettier": "5.5.4", + "file-loader": "4.3.0", + "git-revision-webpack-plugin": "3.0.6", + "html-webpack-plugin": "3.2.0", + "http-server": "0.11.2", + "jest": "27.5.1", + "prettier": "3.7.4", + "standard": "17.1.2", + "webpack": "4.47.0", + "webpack-cli": "3.3.12", + "webpack-dev-server": "3.11.3" } } diff --git a/src/Test_Runner.js b/src/Test_Runner.js index ecc1cedb..98524d4d 100644 --- a/src/Test_Runner.js +++ b/src/Test_Runner.js @@ -42,6 +42,7 @@ const Validator = require('jsonschema').Validator; const validator = new Validator(); const logger = require('./utils/Logger')('Test_Runner.js'); const _ = require('lodash'); +const { v4: uuidv4 } = require('uuid'); const TAG = '[Test_Runner]: '; /** @@ -71,7 +72,7 @@ export class Test_Runner { // Holds the reference to the de referenanced Schma from Open RPC. this.dereferenceSchemaList; this.methodFilters = new MethodFilters(); - const suitesUuid = this.createUUID(); + const suitesUuid = uuidv4(); let execModes = []; let reportTitle; let innerReport; @@ -134,7 +135,7 @@ export class Test_Runner { const module = this.dereferenceSchemaList.methods[methodIndex].name.split('.')[0]; apiExecutionEndTime = 0; apiExecutionStartTime = 0; - let methodUuid = this.createUUID(); // uuid of this method + let methodUuid = uuidv4(); // uuid of this method const method = this.dereferenceSchemaList.methods[methodIndex]; const methodObj = this.dereferenceSchemaList.methods[methodIndex]; let schemaMap = methodObj.result; @@ -162,7 +163,7 @@ export class Test_Runner { error: CONSTANTS.SKIPPED_MESSAGE, param: undefined, methodWithExampleName: methodObj.name, - methodUuid: this.createUUID(), + methodUuid: uuidv4(), schemaData: schemaMap.schema, apiExecutionStartTime: apiExecutionStartTime, apiExecutionEndTime: apiExecutionEndTime, @@ -186,7 +187,7 @@ export class Test_Runner { try { methodWithExampleName = methodObj.name + '.' + methodObj.examples[exampleIndex].name; - methodUuid = this.createUUID(); + methodUuid = uuidv4(); example = method.examples[exampleIndex]; paramValues = example.params.map((p) => p.value); @@ -394,7 +395,7 @@ export class Test_Runner { generateMochaReport(validationStartTime, validationEndTime, reportTitle, validationResultList, suitesUuid, successList, failureList, skippedList, pendingList, innerReport) { // Mocha Report // Below listed values are declared for the report generation - const reportUuid = this.createUUID(); + const reportUuid = uuidv4(); const reportValue = { uuid: '', title: '', @@ -768,15 +769,6 @@ export class Test_Runner { return resultObject; } - createUUID() { - let dt = new Date().getTime(); - const uuid = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) { - const r = (dt + Math.random() * 16) % 16 | 0; - dt = Math.floor(dt / 16); - return (c == 'x' ? r : (r & 0x3) | 0x8).toString(16); - }); - return uuid; - } /** Function to fetch Lifecycle API response and validate the schema */ diff --git a/test/unit/test_runner.test.js b/test/unit/test_runner.test.js index afad3ab4..91a17ff7 100644 --- a/test/unit/test_runner.test.js +++ b/test/unit/test_runner.test.js @@ -19,6 +19,8 @@ import { Test_Runner } from '../../src/Test_Runner'; import { CONSTANTS } from '../../src/constant'; const Validator = require('jsonschema').Validator; +const { v4: uuidv4 } = require('uuid'); + /** * This is a moc stucture of the actual OPEN RPC document * returned by Firebolt SDK. We are just keeping 2 methods and its @@ -832,16 +834,16 @@ describe('Test_Runner test cases', () => { describe('UUID Generation Validation', () => { let firstuuid, seconduuid; test('validate uuid when generated two uuid are different', () => { - firstuuid = runner.createUUID(); - seconduuid = runner.createUUID(); + firstuuid = uuidv4(); + seconduuid = uuidv4(); expect(firstuuid).not.toEqual(seconduuid); }); test('validate uuid when uuid having length 36', () => { - result = runner.createUUID(); + result = uuidv4(); expect(result).toHaveLength(36); }); test('validate uuid when uuid not to be undefined', () => { - result = runner.createUUID(); + result = uuidv4(); expect(result).not.toBe(undefined); }); });