-
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 #6471 from NMDSdevopsServiceAdm/feat/1586-dq-workp…
…lace-restructure Feat/1586 dq workplace restructure
- Loading branch information
Showing
14 changed files
with
643 additions
and
315 deletions.
There are no files selected for viewing
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
8 changes: 7 additions & 1 deletion
8
frontend/src/app/features/subsidiary/workplace/view-subsidiary-workplace.component.html
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
86 changes: 86 additions & 0 deletions
86
frontend/src/app/features/subsidiary/workplace/view-subsidiary-workplace.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,86 @@ | ||
import { HttpClient } from '@angular/common/http'; | ||
import { HttpClientTestingModule } from '@angular/common/http/testing'; | ||
import { ActivatedRoute, Router, RouterModule } from '@angular/router'; | ||
import { RouterTestingModule } from '@angular/router/testing'; | ||
import { BreadcrumbService } from '@core/services/breadcrumb.service'; | ||
import { PermissionsService } from '@core/services/permissions/permissions.service'; | ||
import { UserService } from '@core/services/user.service'; | ||
import { MockBreadcrumbService } from '@core/test-utils/MockBreadcrumbService'; | ||
import { MockPermissionsService } from '@core/test-utils/MockPermissionsService'; | ||
import { SharedModule } from '@shared/shared.module'; | ||
import { render } from '@testing-library/angular'; | ||
|
||
import { Establishment } from '../../../../mockdata/establishment'; | ||
import { ViewSubsidiaryWorkplaceComponent } from './view-subsidiary-workplace.component'; | ||
import { FeatureFlagsService } from '@shared/services/feature-flags.service'; | ||
import { MockFeatureFlagsService } from '@core/test-utils/MockFeatureFlagService'; | ||
import { NewDashboardHeaderComponent } from '@shared/components/new-dashboard-header/dashboard-header.component'; | ||
import { AuthService } from '@core/services/auth.service'; | ||
import { MockAuthService } from '@core/test-utils/MockAuthService'; | ||
import { EstablishmentService } from '@core/services/establishment.service'; | ||
import { AlertService } from '@core/services/alert.service'; | ||
import { WindowRef } from '@core/services/window.ref'; | ||
import { MockUserService } from '@core/test-utils/MockUserService'; | ||
import { Roles } from '@core/model/roles.enum'; | ||
|
||
describe('ViewSubsidiaryWorkplaceComponent', () => { | ||
const setup = async (override: any = { isAdmin: true }) => { | ||
const setupTools = await render(ViewSubsidiaryWorkplaceComponent, { | ||
imports: [SharedModule, RouterModule, RouterTestingModule, HttpClientTestingModule], | ||
providers: [ | ||
AlertService, | ||
WindowRef, | ||
{ | ||
provide: PermissionsService, | ||
useFactory: MockPermissionsService.factory(['canViewEstablishment', 'canViewListOfWorkers']), | ||
deps: [HttpClient, Router, UserService], | ||
}, | ||
{ | ||
provide: UserService, | ||
useFactory: MockUserService.factory(1, Roles.Admin), | ||
deps: [HttpClient], | ||
}, | ||
|
||
{ | ||
provide: BreadcrumbService, | ||
useClass: MockBreadcrumbService, | ||
}, | ||
{ | ||
provide: FeatureFlagsService, | ||
useClass: MockFeatureFlagsService, | ||
}, | ||
{ | ||
provide: AuthService, | ||
useFactory: MockAuthService.factory(true, override.isAdmin), | ||
deps: [HttpClient, Router, EstablishmentService, UserService, PermissionsService], | ||
}, | ||
{ | ||
provide: ActivatedRoute, | ||
useValue: { | ||
snapshot: { | ||
data: { | ||
establishment: Establishment, | ||
}, | ||
}, | ||
}, | ||
}, | ||
], | ||
declarations: [NewDashboardHeaderComponent], | ||
}); | ||
const component = setupTools.fixture.componentInstance; | ||
|
||
return { component, ...setupTools }; | ||
}; | ||
|
||
it('should render a View Subsidiary Workplace Component', async () => { | ||
const { component } = await setup(); | ||
|
||
expect(component).toBeTruthy(); | ||
}); | ||
|
||
it('should show the dashboard header', async () => { | ||
const { getByTestId } = await setup(); | ||
|
||
expect(getByTestId('dashboard-header')).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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,3 +11,7 @@ | |
height: 215px; | ||
} | ||
} | ||
|
||
.do-as-parent-link { | ||
margin-bottom: -1px; | ||
} |
Oops, something went wrong.