diff --git a/package.json b/package.json index f06814080..d67b2ce6f 100644 --- a/package.json +++ b/package.json @@ -170,7 +170,7 @@ "husky": { "hooks": { "pre-commit": "npm run lint:fix", - "pre-push": "run-s test gitSecrets scanRepo" + "pre-push": "run-s test gitSecrets" } } } diff --git a/src/app/providers/app-config/__tests__/app-config.spec.ts b/src/app/providers/app-config/__tests__/app-config.spec.ts index 711f7a2ce..b2f44c580 100644 --- a/src/app/providers/app-config/__tests__/app-config.spec.ts +++ b/src/app/providers/app-config/__tests__/app-config.spec.ts @@ -95,7 +95,7 @@ describe('AppConfigProvider', () => { appConfig.loadRemoteConfig(); tick(); - const request = httpMock.expectOne(`${remoteEnvironmentMock.configUrl}?app_version=4.0`); + const request = httpMock.expectOne(`${remoteEnvironmentMock.configUrl}?app_version=4.0.0.0`); expect(request.request.method).toBe('GET'); request.flush(environmentResponseMock); })); diff --git a/src/app/providers/app-config/app-config.ts b/src/app/providers/app-config/app-config.ts index 2775385b9..b46375b56 100644 --- a/src/app/providers/app-config/app-config.ts +++ b/src/app/providers/app-config/app-config.ts @@ -185,7 +185,7 @@ export class AppConfigProvider { return; } - this.appInfoProvider.getMajorAndMinorVersionNumber() + this.appInfoProvider.getFullVersionNumber() .then((version: string) => { const url = `${this.environmentFile.configUrl}?app_version=${version}`; this.httpClient.get(url) diff --git a/src/app/providers/app-info/__mocks__/app-info.mock.ts b/src/app/providers/app-info/__mocks__/app-info.mock.ts index b35198798..71124f542 100644 --- a/src/app/providers/app-info/__mocks__/app-info.mock.ts +++ b/src/app/providers/app-info/__mocks__/app-info.mock.ts @@ -4,6 +4,8 @@ export class AppInfoProviderMock { getVersionNumber = jasmine.createSpy('getVersionNumber').and.returnValue(of('4.0.0')); + getFullVersionNumber = jasmine.createSpy('getVersionNumber').and.returnValue(Promise.resolve('4.0.0.0')); + getMajorAndMinorVersionNumber = jasmine .createSpy('getMajorAndMinorVersionNumber').and.returnValue(Promise.resolve('4.0')); } diff --git a/src/app/providers/app-info/app-info.ts b/src/app/providers/app-info/app-info.ts index fba5fb1ea..cdad88e33 100644 --- a/src/app/providers/app-info/app-info.ts +++ b/src/app/providers/app-info/app-info.ts @@ -11,6 +11,10 @@ export class AppInfoProvider { return from(this.appVersion.getVersionNumber()); } + public getFullVersionNumber(): Promise { + return this.appVersion.getVersionNumber(); + } + public async getMajorAndMinorVersionNumber(): Promise { const versionNumber = await this.appVersion.getVersionNumber(); const majorVersion = versionNumber.split('.')[0]; diff --git a/src/app/providers/category-whitelist/category-whitelist.ts b/src/app/providers/category-whitelist/category-whitelist.ts index 2e9f37515..7652316c6 100644 --- a/src/app/providers/category-whitelist/category-whitelist.ts +++ b/src/app/providers/category-whitelist/category-whitelist.ts @@ -1,39 +1,6 @@ import { TestCategory } from '@dvsa/mes-test-schema/category-definitions/common/test-category'; import { Injectable } from '@angular/core'; -// list all test categories that are able to be started by the users -export const whiteList: TestCategory[] = [ - // TestCategory.ADI2, - TestCategory.B, - // TestCategory.BE, - // TestCategory.C, - // TestCategory.C1, - // TestCategory.CE, - // TestCategory.C1E, - // TestCategory.CM, - // TestCategory.CEM, - // TestCategory.C1M, - // TestCategory.C1EM, - // TestCategory.CCPC, - // TestCategory.DCPC, - // TestCategory.D, - // TestCategory.D1, - // TestCategory.D1E, - // TestCategory.DE, - // TestCategory.EUAM1, - // TestCategory.EUA1M1, - // TestCategory.EUA2M1, - // TestCategory.EUAMM1, - // TestCategory.EUAMM2, - // TestCategory.EUA1M2, - // TestCategory.EUA2M2, - // TestCategory.EUAM2, - // TestCategory.F, - // TestCategory.G, - // TestCategory.H, - // TestCategory.K, -]; - @Injectable() export class CategoryWhitelistProvider { @@ -41,7 +8,7 @@ export class CategoryWhitelistProvider { * Function to check if the passed in Category exists in the category whitelist * @param category */ - isWhiteListed(category: TestCategory): boolean { + isWhiteListed(category: TestCategory, whiteList: TestCategory[]): boolean { return whiteList.some((cat) => { return cat === category; }); diff --git a/src/components/test-slot/test-slot/test-slot.ts b/src/components/test-slot/test-slot/test-slot.ts index 35791e9da..f0f257823 100644 --- a/src/components/test-slot/test-slot/test-slot.ts +++ b/src/components/test-slot/test-slot/test-slot.ts @@ -129,7 +129,10 @@ export class TestSlotComponent implements SlotComponent, OnInit { canStartTest(): boolean { return this.slotProvider.canStartTest(this.slot) - && this.categoryWhitelist.isWhiteListed(this.slot.booking.application.testCategory as TestCategory); + && this.categoryWhitelist.isWhiteListed( + this.slot.booking.application.testCategory as TestCategory, + this.appConfig.getAppConfig().journal.allowedTestCategories as TestCategory[], + ); } canViewCandidateDetails(): boolean {