From 36556a878432a1e41ea45da8c213327b6ee24161 Mon Sep 17 00:00:00 2001 From: Daniel Searle Date: Wed, 10 Jul 2024 11:44:19 +0100 Subject: [PATCH] feat(CB2-12693): use common test type id fine, linting fixes --- src/models/index.d.ts | 10 +++++----- src/services/RetroGenerationService.ts | 7 +++---- tests/unit/RetroGenerationService.unitTest.ts | 2 +- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/src/models/index.d.ts b/src/models/index.d.ts index 26f6052..5727530 100644 --- a/src/models/index.d.ts +++ b/src/models/index.d.ts @@ -19,11 +19,11 @@ interface IInvokeConfig { } interface IActivityParam { - testerStaffId: string - fromStartTime: string, - toStartTime?: null | string, - testStationPNumber: string, - activityType: string + testerStaffId: string; + fromStartTime: string; + toStartTime?: null | string; + testStationPNumber: string; + activityType: string; } export { ISPConfig, IInvokeConfig, IActivitiesList, IActivityParam}; diff --git a/src/services/RetroGenerationService.ts b/src/services/RetroGenerationService.ts index c83b9e9..8a3e4ca 100644 --- a/src/services/RetroGenerationService.ts +++ b/src/services/RetroGenerationService.ts @@ -8,7 +8,8 @@ import moment = require("moment-timezone"); import { ActivitySchema} from "@dvsa/cvs-type-definitions/types/v1/activity"; import { TestResultSchema, TestTypeSchema} from "@dvsa/cvs-type-definitions/types/v1/test-result"; import { ModTypeSchema} from "@dvsa/cvs-type-definitions/types/v1/test-type"; -import {LEC_TEST} from "@dvsa/cvs-microservice-common/classes/testTypes/Constants"; +import { LEC_TEST } from "@dvsa/cvs-microservice-common/classes/testTypes/Constants"; +import {TestTypeHelper} from "@dvsa/cvs-microservice-common/classes/testTypes/testTypeHelper"; class RetroGenerationService { private readonly testResultsService: TestResultsService; @@ -381,9 +382,7 @@ class RetroGenerationService { * @param testType */ private isPassingLECTestType(testType: any): boolean { - - const lecTestTypeIds = LEC_TEST.IDS; - return lecTestTypeIds.includes(testType.testTypeId) && testType.testResult === TEST_RESULT_STATES.PASS; + return TestTypeHelper.validateTestTypeIdInList(LEC_TEST, testType.testTypeId) && testType.testResult === TEST_RESULT_STATES.PASS; } } diff --git a/tests/unit/RetroGenerationService.unitTest.ts b/tests/unit/RetroGenerationService.unitTest.ts index 27b9d11..2e58605 100644 --- a/tests/unit/RetroGenerationService.unitTest.ts +++ b/tests/unit/RetroGenerationService.unitTest.ts @@ -8,7 +8,7 @@ import hgvTrlResults from "../resources/hgv-trl-test-results.json"; import activities from "../resources/wait-time-response.json"; import queueEvent from "../resources/queue-event.json"; import { ActivitySchema } from "@dvsa/cvs-type-definitions/types/v1/activity"; -import { TestResultSchema } from "@dvsa/cvs-type-definitions/types/v1/test-result"; +import { TestResultSchema } from "@dvsa/cvs-type-definitions/types/v1/test-result"; // import mockConfig from "../util/mockConfig"; describe("RetroGenerationService", () => {