-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6306 from NMDSdevopsServiceAdm/fix/1477-cqc-workp…
…lace-questions-in-sub-navigate-to-parent Fix/1477 cqc workplace questions in sub navigate to parent
- Loading branch information
Showing
10 changed files
with
150 additions
and
34 deletions.
There are no files selected for viewing
43 changes: 43 additions & 0 deletions
43
frontend/src/app/features/workplace/regulated-by-cqc/regulated-by-cqc.component.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import { HttpClientTestingModule } from '@angular/common/http/testing'; | ||
import { ReactiveFormsModule, UntypedFormBuilder } from '@angular/forms'; | ||
import { RouterModule } from '@angular/router'; | ||
import { RouterTestingModule } from '@angular/router/testing'; | ||
import { EstablishmentService } from '@core/services/establishment.service'; | ||
import { LocationService } from '@core/services/location.service'; | ||
import { SharedModule } from '@shared/shared.module'; | ||
import { render } from '@testing-library/angular'; | ||
|
||
import { RegulatedByCqcComponent } from './regulated-by-cqc.component'; | ||
|
||
describe('RegulatedByCqcComponent', () => { | ||
const workplaceUid = 'abc131355543435'; | ||
|
||
async function setup() { | ||
const { fixture, getByText } = await render(RegulatedByCqcComponent, { | ||
imports: [SharedModule, RouterModule, RouterTestingModule, HttpClientTestingModule, ReactiveFormsModule], | ||
providers: [ | ||
UntypedFormBuilder, | ||
{ | ||
provide: EstablishmentService, | ||
useValue: { | ||
establishment: { uid: workplaceUid }, | ||
}, | ||
}, | ||
LocationService, | ||
], | ||
}); | ||
|
||
const component = fixture.componentInstance; | ||
|
||
return { | ||
component, | ||
fixture, | ||
getByText, | ||
}; | ||
} | ||
|
||
it('should render a RegulatedByCqcComponent', async () => { | ||
const { component } = await setup(); | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
...tend/src/app/features/workplace/workplace-not-found/workplace-not-found.component.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import { HttpClientTestingModule } from '@angular/common/http/testing'; | ||
import { ReactiveFormsModule, UntypedFormBuilder } from '@angular/forms'; | ||
import { RouterModule } from '@angular/router'; | ||
import { RouterTestingModule } from '@angular/router/testing'; | ||
import { EstablishmentService } from '@core/services/establishment.service'; | ||
import { LocationService } from '@core/services/location.service'; | ||
import { SharedModule } from '@shared/shared.module'; | ||
import { render } from '@testing-library/angular'; | ||
|
||
import { WorkplaceNotFoundComponent } from './workplace-not-found.component'; | ||
|
||
describe('WorkplaceNotFoundComponent', () => { | ||
const workplaceUid = 'abc131355543435'; | ||
|
||
async function setup() { | ||
const { fixture, getByText } = await render(WorkplaceNotFoundComponent, { | ||
imports: [SharedModule, RouterModule, RouterTestingModule, HttpClientTestingModule, ReactiveFormsModule], | ||
providers: [ | ||
UntypedFormBuilder, | ||
{ | ||
provide: EstablishmentService, | ||
useValue: { | ||
establishment: { uid: workplaceUid }, | ||
}, | ||
}, | ||
LocationService, | ||
], | ||
}); | ||
|
||
const component = fixture.componentInstance; | ||
|
||
return { | ||
component, | ||
fixture, | ||
getByText, | ||
}; | ||
} | ||
|
||
it('should render a WorkplaceNotFoundComponent', async () => { | ||
const { component } = await setup(); | ||
expect(component).toBeTruthy(); | ||
}); | ||
|
||
it('should show a go back link with workplace uid in url', async () => { | ||
const { getByText } = await setup(); | ||
|
||
const link = getByText('go back and try again'); | ||
|
||
expect(link.getAttribute('href')).toEqual(`/workplace/${workplaceUid}/regulated-by-cqc`); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters