From 42e205030cbee92400c29e4cb06f798bfe8dc500 Mon Sep 17 00:00:00 2001 From: Shaed Parkar Date: Tue, 3 Dec 2024 09:05:14 +0000 Subject: [PATCH] update test setup to use ref data spy --- .../Extensions/HearingDetailsResponseExtensionsTests.cs | 8 +------- .../create-hearing/create-hearing.component.spec.ts | 3 +++ .../bookings-list/bookings-list.component.spec.ts | 5 ++--- 3 files changed, 6 insertions(+), 10 deletions(-) diff --git a/AdminWebsite/AdminWebsite.UnitTests/Extensions/HearingDetailsResponseExtensionsTests.cs b/AdminWebsite/AdminWebsite.UnitTests/Extensions/HearingDetailsResponseExtensionsTests.cs index b9e7cd5a2..c079d6284 100644 --- a/AdminWebsite/AdminWebsite.UnitTests/Extensions/HearingDetailsResponseExtensionsTests.cs +++ b/AdminWebsite/AdminWebsite.UnitTests/Extensions/HearingDetailsResponseExtensionsTests.cs @@ -1,19 +1,13 @@ -using AdminWebsite.Extensions; -using AdminWebsite.Models; -using FizzWare.NBuilder; using AdminWebsite.Contracts.Responses; -using VideoApi.Contract.Enums; namespace AdminWebsite.UnitTests.Extensions { public class HearingDetailsResponseExtensionsTests { - private HearingDetailsResponse _hearing; - [SetUp] public void Setup() { - _hearing = new HearingDetailsResponse + new HearingDetailsResponse { Id = Guid.NewGuid(), Participants = new List() diff --git a/AdminWebsite/AdminWebsite/ClientApp/src/app/booking/create-hearing/create-hearing.component.spec.ts b/AdminWebsite/AdminWebsite/ClientApp/src/app/booking/create-hearing/create-hearing.component.spec.ts index 2fe0e5f0a..89baf4f80 100644 --- a/AdminWebsite/AdminWebsite/ClientApp/src/app/booking/create-hearing/create-hearing.component.spec.ts +++ b/AdminWebsite/AdminWebsite/ClientApp/src/app/booking/create-hearing/create-hearing.component.spec.ts @@ -86,6 +86,7 @@ describe('CreateHearingComponent with multiple Services', () => { imports: [SharedModule, RouterTestingModule], providers: [ { provide: VideoHearingsService, useValue: videoHearingsServiceSpy }, + { provide: ReferenceDataService, useValue: refDataServiceSpy }, { provide: Router, useValue: routerSpy }, { provide: ErrorService, useValue: errorService }, { provide: BookingService, useValue: bookingServiceSpy }, @@ -229,6 +230,7 @@ describe('CreateHearingComponent with single Service', () => { imports: [HttpClientModule, ReactiveFormsModule, RouterTestingModule], providers: [ { provide: VideoHearingsService, useValue: videoHearingsServiceSpy }, + { provide: ReferenceDataService, useValue: refDataServiceSpy }, { provide: Router, useValue: routerSpy }, { provide: ErrorService, useValue: errorService }, { provide: BookingService, useValue: bookingServiceSpy }, @@ -296,6 +298,7 @@ describe('CreateHearingComponent with existing request in session', () => { imports: [HttpClientModule, ReactiveFormsModule, RouterTestingModule], providers: [ { provide: VideoHearingsService, useValue: videoHearingsServiceSpy }, + { provide: ReferenceDataService, useValue: refDataServiceSpy }, { provide: Router, useValue: routerSpy }, { provide: ErrorService, useValue: errorService }, { provide: BookingService, useValue: bookingServiceSpy }, diff --git a/AdminWebsite/AdminWebsite/ClientApp/src/app/bookings-list/bookings-list/bookings-list.component.spec.ts b/AdminWebsite/AdminWebsite/ClientApp/src/app/bookings-list/bookings-list/bookings-list.component.spec.ts index d2961b7e8..e399f2932 100644 --- a/AdminWebsite/AdminWebsite/ClientApp/src/app/bookings-list/bookings-list/bookings-list.component.spec.ts +++ b/AdminWebsite/AdminWebsite/ClientApp/src/app/bookings-list/bookings-list/bookings-list.component.spec.ts @@ -54,10 +54,9 @@ const videoHearingServiceSpy = jasmine.createSpyObj('VideoHearingService', [ 'cancelRequest', 'getHearingById', 'mapHearingDetailsResponseToHearingModel', - 'getHearingTypes', 'getUsers' ]); -const referenceDataServiceSpy = jasmine.createSpyObj('ReferenceDataService', ['getCourts']); +const referenceDataServiceSpy = jasmine.createSpyObj('ReferenceDataService', ['getCourts', 'getHearingTypes']); const launchDarklyServiceSpy = jasmine.createSpyObj('LaunchDarklyService', ['getFlag']); let returnUrlService: ReturnUrlService; const featureFlagServiceSpy = jasmine.createSpyObj('FeatureFlagService', ['getFeatureFlagByName']); @@ -585,7 +584,7 @@ describe('BookingsListComponent', () => { routerSpy = jasmine.createSpyObj('Router', ['navigate']); videoHearingServiceSpy.getHearingById.and.returnValue(of(new HearingDetailsResponse())); - videoHearingServiceSpy.getHearingTypes.and.returnValue(of(new Array())); + referenceDataServiceSpy.getHearingTypes.and.returnValue(of(new Array())); configServiceSpy.getConfig.and.returnValue({}); referenceDataServiceSpy.getCourts.and.returnValue(of(new Array()));