Skip to content

Commit

Permalink
fix unit test (#369)
Browse files Browse the repository at this point in the history
  • Loading branch information
yzlucas authored Dec 12, 2024
1 parent 2e2128d commit c305f9f
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ describe('App Routing Module', () => {

it('should have correct routes defined', () => {
const routes = router.config;
expect(routes.length).toBe(6);
expect(routes.length).toBe(5);
});

it('should define route for LIST path', () => {
Expand Down
19 changes: 6 additions & 13 deletions client/wfprev-war/src/main/angular/src/app/app.routing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ const PANEL_ROUTES: Routes = [
path: ResourcesRoutes.LIST,
loadChildren: () =>
import('src/app/components/list.module').then(m => m.ListModule),
canActivate: [PrevAuthGuard],
data: { scopes: PROFILE_SCOPES },
canActivate: [PrevAuthGuard],
data: { scopes: PROFILE_SCOPES },
},
{
path: ResourcesRoutes.MAP,
loadChildren: () =>
import('src/app/components/map.module').then(m => m.MapModule),
canActivate: [PrevAuthGuard],
data: { scopes: PROFILE_SCOPES }
canActivate: [PrevAuthGuard],
data: { scopes: PROFILE_SCOPES }
},
{
path: ResourcesRoutes.ERROR_PAGE,
Expand All @@ -33,15 +33,8 @@ const PANEL_ROUTES: Routes = [
},
{
path: '',
canActivate: [PrevAuthGuard], // Guard the empty path
data: { scopes: PROFILE_SCOPES },
children: [
{
path: '',
redirectTo: ResourcesRoutes.MAP,
pathMatch: 'full',
}
]
redirectTo: ResourcesRoutes.MAP,
pathMatch: 'full'
}
];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<div class="title-bar">
<span>Create New Project</span>
</div>
<form [formGroup]="projectForm" (ngSubmit)="onCreate()">
<form [formGroup]="projectForm">
<div class="dialog-content">
<div class="form-row">
<div class="form-field">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,4 +153,8 @@ select {
background-repeat: no-repeat;
background-position: right 10px center;
background-size: 12px;
}

::ng-deep .mdc-snackbar__surface{
background-color: transparent !important;
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@ describe('ProjectDetailsComponent', () => {
});

it('should mark the form as invalid if required fields are missing', () => {
component.detailsForm.controls['projectLead'].setValue('');
component.detailsForm.controls['projectLeadEmailAddress'].setValue('');
component.detailsForm.controls['projectTypeCode'].setValue('');
expect(component.detailsForm.invalid).toBeTrue();
});

Expand Down Expand Up @@ -66,14 +65,6 @@ describe('ProjectDetailsComponent', () => {
});
});

describe('onSave Method', () => {
it('should log form data if the form is valid', () => {
spyOn(console, 'log');
component.onSave();
expect(console.log).toHaveBeenCalledWith('Form Data:', component.detailsForm.value);
});
});

describe('onCancel Method', () => {
it('should reset the form', () => {
spyOn(component.detailsForm, 'reset');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ describe('AppHeaderComponent', () => {
spyOn(window, 'open');
component.onSupportLinkClick();
expect(window.open).toHaveBeenCalledWith(
'https://intranet.gov.bc.ca/bcws/provincial-programs/strategic-initiatives-and-innovation/wildfire-one/wildfire-one-training',
'https://intranet.gov.bc.ca/bcws/corporate-governance/strategic-initiatives-and-innovation/wildfire-one/wildfire-one-training',
'_blank',
'noopener'
);
Expand Down
7 changes: 6 additions & 1 deletion client/wfprev-war/src/main/angular/src/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,17 @@ body {
width: fit-content;
text-align: center;
.mat-mdc-simple-snack-bar {
font-family: var(--wf-font-family-main);
font-family: var(--wf-font-family-main) !important;
font-size: 13px;
}
.mat-button-wrapper {
color: white;
}
.mat-mdc-snack-bar-action {
color: white !important;
border: 1px solid white;
border-radius: 5px;
}
}


Expand Down

0 comments on commit c305f9f

Please sign in to comment.