diff --git a/package.json b/package.json index 3b270a4..8eb171f 100644 --- a/package.json +++ b/package.json @@ -100,5 +100,9 @@ "hooks": { "pre-commit": "npx pretty-quick --staged && npm run format:lint && npx lint-staged" } + }, + "browser": { + "child_process": false, + "fs": false } } diff --git a/src/app/_guards/auth.guard.spec.ts b/src/app/_guards/auth.guard.spec.ts index 7e638c6..ec0ea01 100644 --- a/src/app/_guards/auth.guard.spec.ts +++ b/src/app/_guards/auth.guard.spec.ts @@ -3,12 +3,15 @@ import { TestBed } from '@angular/core/testing'; // Application imports import { AuthGuard } from '@app/_guards/auth.guard'; +import {RouterTestingModule} from '@angular/router/testing'; describe('AuthGuard', () => { let guard: AuthGuard; beforeEach(() => { - TestBed.configureTestingModule({}); + TestBed.configureTestingModule({ + imports: [RouterTestingModule] + }); guard = TestBed.inject(AuthGuard); }); diff --git a/src/app/_guards/role.guard.spec.ts b/src/app/_guards/role.guard.spec.ts index 3c78c74..8f2f025 100644 --- a/src/app/_guards/role.guard.spec.ts +++ b/src/app/_guards/role.guard.spec.ts @@ -3,12 +3,15 @@ import { TestBed } from '@angular/core/testing'; // Application imports import { RoleGuard } from '@app/_guards/role.guard'; +import {RouterTestingModule} from '@angular/router/testing'; describe('RoleGuard', () => { let guard: RoleGuard; beforeEach(() => { - TestBed.configureTestingModule({}); + TestBed.configureTestingModule({ + imports: [RouterTestingModule] + }); guard = TestBed.inject(RoleGuard); }); diff --git a/src/app/_services/auth.service.spec.ts b/src/app/_services/auth.service.spec.ts index 9351d3f..f1d04be 100644 --- a/src/app/_services/auth.service.spec.ts +++ b/src/app/_services/auth.service.spec.ts @@ -1,12 +1,15 @@ import { TestBed } from '@angular/core/testing'; import { AuthService } from '@app/_services/auth.service'; +import {HttpClientTestingModule} from '@angular/common/http/testing'; describe('AuthService', () => { let service: AuthService; beforeEach(() => { - TestBed.configureTestingModule({}); + TestBed.configureTestingModule({ + imports: [HttpClientTestingModule] + }); service = TestBed.inject(AuthService); }); diff --git a/src/app/_services/location.service.spec.ts b/src/app/_services/location.service.spec.ts index 163c636..6e88765 100644 --- a/src/app/_services/location.service.spec.ts +++ b/src/app/_services/location.service.spec.ts @@ -1,12 +1,15 @@ import { TestBed } from '@angular/core/testing'; import { LocationService } from '@app/_services/location.service'; +import {HttpClientTestingModule} from '@angular/common/http/testing'; describe('LocationService', () => { let service: LocationService; beforeEach(() => { - TestBed.configureTestingModule({}); + TestBed.configureTestingModule({ + imports: [HttpClientTestingModule] + }); service = TestBed.inject(LocationService); }); diff --git a/src/app/app.component.spec.ts b/src/app/app.component.spec.ts index ade1136..3ab4d82 100644 --- a/src/app/app.component.spec.ts +++ b/src/app/app.component.spec.ts @@ -8,11 +8,12 @@ import { TopbarStubComponent, TransactionServiceStub, } from '@src/testing'; +import {HttpClientTestingModule} from '@angular/common/http/testing'; describe('AppComponent', () => { beforeEach(async () => { await TestBed.configureTestingModule({ - imports: [RouterTestingModule], + imports: [HttpClientTestingModule, RouterTestingModule], declarations: [AppComponent, FooterStubComponent, SidebarStubComponent, TopbarStubComponent], providers: [{ provide: TransactionService, useClass: TransactionServiceStub }], }).compileComponents(); diff --git a/src/app/auth/auth.component.spec.ts b/src/app/auth/auth.component.spec.ts index c11871f..6a311e2 100644 --- a/src/app/auth/auth.component.spec.ts +++ b/src/app/auth/auth.component.spec.ts @@ -1,6 +1,7 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { AuthComponent } from '@app/auth/auth.component'; +import {HttpClientTestingModule} from '@angular/common/http/testing'; describe('AuthComponent', () => { let component: AuthComponent; @@ -8,6 +9,7 @@ describe('AuthComponent', () => { beforeEach(async () => { await TestBed.configureTestingModule({ + imports: [HttpClientTestingModule], declarations: [AuthComponent], }).compileComponents(); }); diff --git a/src/app/pages/admin/admin.component.spec.ts b/src/app/pages/admin/admin.component.spec.ts index 2b5a69d..e0f830f 100644 --- a/src/app/pages/admin/admin.component.spec.ts +++ b/src/app/pages/admin/admin.component.spec.ts @@ -48,7 +48,7 @@ describe('AdminComponent', () => { it('#approveAction should toggle approval status', () => { const action = userService.getActionById('1'); - expect(action).toBe({ + expect(action).toEqual({ id: 1, user: 'Tom', role: 'enroller', diff --git a/src/app/pages/transactions/transaction-details/transaction-details.component.spec.ts b/src/app/pages/transactions/transaction-details/transaction-details.component.spec.ts index 8fce2e7..783a426 100644 --- a/src/app/pages/transactions/transaction-details/transaction-details.component.spec.ts +++ b/src/app/pages/transactions/transaction-details/transaction-details.component.spec.ts @@ -1,6 +1,7 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { TransactionDetailsComponent } from '@pages/transactions/transaction-details/transaction-details.component'; +import {RouterTestingModule} from '@angular/router/testing'; describe('TransactionDetailsComponent', () => { let component: TransactionDetailsComponent; @@ -8,6 +9,7 @@ describe('TransactionDetailsComponent', () => { beforeEach(async () => { await TestBed.configureTestingModule({ + imports: [RouterTestingModule], declarations: [TransactionDetailsComponent], }).compileComponents(); });