Skip to content

Commit

Permalink
Add RouterTestingModule to imports in dashboard-page.component.spec.t…
Browse files Browse the repository at this point in the history
…s and machines-page.component.spec.ts
  • Loading branch information
akozma89 committed Jan 5, 2024
1 parent 84a9b75 commit f5e8414
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { DashboardPageComponent } from './dashboard-page.component';
import { MockStore, provideMockStore } from '@ngrx/store/testing';
import { AppStore } from '@interfaces/app-store.interface';
import { Store } from '@ngrx/store';
import { RouterTestingModule } from '@angular/router/testing';

describe('DashboardPageComponent', () => {
let component: DashboardPageComponent;
Expand All @@ -12,7 +13,7 @@ describe('DashboardPageComponent', () => {

beforeEach(() => {
TestBed.configureTestingModule({
imports: [DashboardPageComponent],
imports: [DashboardPageComponent, RouterTestingModule],
providers: [provideMockStore({})],
}).compileComponents();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ import { MachinePageComponent } from './machine-page.component';
import { MockStore, provideMockStore } from '@ngrx/store/testing';
import { of } from 'rxjs';
import machineSelectors from '@stores/machines/machines.selectors';
import {
MachineColorStatusMap,
MachineStatusMap,
} from '@interfaces/machine-events-options.interface';
import { Component, Input } from '@angular/core';
import { Store } from '@ngrx/store';
import { MapComponent } from '@components/map/map.component';
import {
MACHINE_COLORS_STATUS_MAP,
MACHINE_STATUS_MAP,
} from '@constants/machine.constant';

@Component({
standalone: true,
Expand All @@ -32,6 +32,7 @@ describe('MachinePageComponent', () => {

beforeEach(() => {
paramMapSpy = jasmine.createSpy('paramMap');
queryParamMapSpy = jasmine.createSpy('queryParamMap');
activatedRouteStub = {};

Object.defineProperties(activatedRouteStub, {
Expand Down Expand Up @@ -133,13 +134,13 @@ describe('MachinePageComponent', () => {
describe('getStatusColor', () => {
it('should return color', () => {
// GIVEN
const status = MachineStatusMap.idle;
const status = MACHINE_STATUS_MAP.idle;

// WHEN
const color = component.getStatusColor(status);

// THEN
expect(color).toEqual(MachineColorStatusMap.idle);
expect(color).toEqual(MACHINE_COLORS_STATUS_MAP.idle);
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { Store } from '@ngrx/store';
import { MACHINES_STORE } from '@interfaces/machines-state.interface';
import { SETTINGS_STORE } from '@interfaces/settings-state.interface';
import { AppStore } from '@interfaces/app-store.interface';
import { RouterTestingModule } from '@angular/router/testing';

describe('MachinesPageComponent', () => {
let component: MachinesPageComponent;
Expand All @@ -28,7 +29,7 @@ describe('MachinesPageComponent', () => {

beforeEach(() => {
TestBed.configureTestingModule({
imports: [MachinesPageComponent],
imports: [MachinesPageComponent, RouterTestingModule],
providers: [provideMockStore({ initialState })],
}).compileComponents();

Expand Down

0 comments on commit f5e8414

Please sign in to comment.