diff --git a/package-lock.json b/package-lock.json index 75373565ce..836f41298a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "cvs-app-vtm", - "version": "1.29", + "version": "1.30", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "cvs-app-vtm", - "version": "1.29", + "version": "1.30", "license": "MIT", "dependencies": { "@angular/animations": "^18.2.7", @@ -53,6 +53,7 @@ "@commitlint/config-conventional": "^18.6.2", "@compodoc/compodoc": "^1.1.23", "@dvsa/biome-config": "0.2.0", + "@dvsa/cvs-microservice-common": "1.3.1", "@ngrx/schematics": "^18.0.2", "@sentry/cli": "^2.32.2", "@types/jest": "^29.5.12", @@ -4488,6 +4489,16 @@ "dev": true, "license": "ISC" }, + "node_modules/@dvsa/cvs-microservice-common": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/@dvsa/cvs-microservice-common/-/cvs-microservice-common-1.3.1.tgz", + "integrity": "sha512-dxXWTXd4hHzuJINv6kBzDTPLtk/iG+vj3EcU2d7Fo5PUtWRBOPU1gLVn1Pl5bMGOJ5sHYLnWkFMcoUv7UgBsoA==", + "dev": true, + "dependencies": { + "class-transformer": "^0.5.1", + "dayjs": "^1.11.13" + } + }, "node_modules/@dvsa/cvs-type-definitions": { "version": "7.8.0", "resolved": "https://registry.npmjs.org/@dvsa/cvs-type-definitions/-/cvs-type-definitions-7.8.0.tgz", @@ -9788,6 +9799,12 @@ "integrity": "sha512-0TNiGstbQmCFwt4akjjBg5pLRTSyj/PkWQ1ZoO2zntmg9yLqSRxwEa4iCfQLGjqhiqBfOJa7W/E8wfGrTDmlZQ==", "dev": true }, + "node_modules/class-transformer": { + "version": "0.5.1", + "resolved": "https://registry.npmjs.org/class-transformer/-/class-transformer-0.5.1.tgz", + "integrity": "sha512-SQa1Ws6hUbfC98vKGxZH3KFY0Y1lm5Zm0SY8XX9zbK7FJCyVEac3ATW0RIpwzW+oOfmHE5PMPufDG9hCfoEOMw==", + "dev": true + }, "node_modules/clean-css": { "version": "5.3.3", "resolved": "https://registry.npmjs.org/clean-css/-/clean-css-5.3.3.tgz", @@ -10823,6 +10840,12 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/dayjs": { + "version": "1.11.13", + "resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.11.13.tgz", + "integrity": "sha512-oaMBel6gjolK862uaPQOVTA7q3TZhuSvuMQAAglQDOWYO9A91IrAOUJEyKVlqJlHE0vq5p5UXxzdPfMH/x6xNg==", + "dev": true + }, "node_modules/debug": { "version": "4.3.7", "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.7.tgz", diff --git a/package.json b/package.json index 9933ccf9b0..4b5ae9706f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "cvs-app-vtm", - "version": "1.29", + "version": "1.30", "description": "DVSA CVS Vehicle Testing Management Application", "main": "index.js", "engines": { @@ -75,6 +75,7 @@ "@commitlint/config-conventional": "^18.6.2", "@compodoc/compodoc": "^1.1.23", "@dvsa/biome-config": "0.2.0", + "@dvsa/cvs-microservice-common": "1.3.1", "@ngrx/schematics": "^18.0.2", "@sentry/cli": "^2.32.2", "@types/jest": "^29.5.12", diff --git a/src/app/features/test-records/components/vehicle-header/__tests__/vehicle-header.component.spec.ts b/src/app/features/test-records/components/vehicle-header/__tests__/vehicle-header.component.spec.ts index d188089987..d59afa1d74 100644 --- a/src/app/features/test-records/components/vehicle-header/__tests__/vehicle-header.component.spec.ts +++ b/src/app/features/test-records/components/vehicle-header/__tests__/vehicle-header.component.spec.ts @@ -1,7 +1,7 @@ import { HttpClientTestingModule } from '@angular/common/http/testing'; import { ComponentFixture, TestBed } from '@angular/core/testing'; import { RouterTestingModule } from '@angular/router/testing'; -import { TestType } from '@models/test-types/test-type.model'; +import { TestType, resultOfTestEnum } from '@models/test-types/test-type.model'; import { V3TechRecordModel, VehicleConfigurations, VehicleTypes } from '@models/vehicle-tech-record.model'; import { provideMockStore } from '@ngrx/store/testing'; import { HttpService } from '@services/http/http.service'; @@ -109,4 +109,20 @@ describe('VehicleHeaderComponent', () => { expect(component.isADRTest).toBe(false); }); }); + + describe('shouldShowAbandonCert', () => { + it('should return true if the VTG/VTP12 document should show', () => { + jest.spyOn(component, 'resultOfTest', 'get').mockReturnValue(resultOfTestEnum.abandoned); + jest.spyOn(component, 'test', 'get').mockReturnValue({ testTypeId: '3' } as TestType); + jest.spyOn(component, 'vehicleTypes', 'get').mockReturnValue('psv' as unknown as typeof VehicleTypes); + expect(component.shouldShowAbandonCert).toBe(true); + }); + + it('should return false if the VTG/VTP12 document should show', () => { + jest.spyOn(component, 'resultOfTest', 'get').mockReturnValue(resultOfTestEnum.abandoned); + jest.spyOn(component, 'test', 'get').mockReturnValue({ testTypeId: '193' } as TestType); + jest.spyOn(component, 'vehicleTypes', 'get').mockReturnValue('psv' as unknown as typeof VehicleTypes); + expect(component.shouldShowAbandonCert).toBe(false); + }); + }); }); diff --git a/src/app/features/test-records/components/vehicle-header/vehicle-header.component.html b/src/app/features/test-records/components/vehicle-header/vehicle-header.component.html index 2690ce269b..2d87c6bae8 100644 --- a/src/app/features/test-records/components/vehicle-header/vehicle-header.component.html +++ b/src/app/features/test-records/components/vehicle-header/vehicle-header.component.html @@ -21,11 +21,11 @@