Skip to content

Commit

Permalink
update test setup to use ref data spy
Browse files Browse the repository at this point in the history
  • Loading branch information
shaed-parkar committed Dec 3, 2024
1 parent 9c8b348 commit 42e2050
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -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<ParticipantResponse>()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 },
Expand Down Expand Up @@ -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 },
Expand Down Expand Up @@ -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 },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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>('ReferenceDataService', ['getCourts', 'getHearingTypes']);
const launchDarklyServiceSpy = jasmine.createSpyObj<LaunchDarklyService>('LaunchDarklyService', ['getFlag']);
let returnUrlService: ReturnUrlService;
const featureFlagServiceSpy = jasmine.createSpyObj('FeatureFlagService', ['getFeatureFlagByName']);
Expand Down Expand Up @@ -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<HearingTypeResponse>()));
referenceDataServiceSpy.getHearingTypes.and.returnValue(of(new Array<HearingTypeResponse>()));
configServiceSpy.getConfig.and.returnValue({});

referenceDataServiceSpy.getCourts.and.returnValue(of(new Array<HearingVenueResponse>()));
Expand Down

0 comments on commit 42e2050

Please sign in to comment.