Skip to content

Commit 4d0231a

Browse files
LayZeeDKaaronfrost
authored andcommitted
test(ng-lib): working test suites (#96)
* test(ng-lib): fix test suites * style: format code
1 parent 825bc22 commit 4d0231a

File tree

3 files changed

+30
-4
lines changed

3 files changed

+30
-4
lines changed

projects/scullyio/ng-lib/src/lib/idleMonitor/idle-monitor.service.spec.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
11
import { TestBed } from '@angular/core/testing';
2+
import { RouterTestingModule } from '@angular/router/testing';
23

34
import { IdleMonitorService } from './idle-monitor.service';
45

56
describe('IdleMonitorService', () => {
67
let service: IdleMonitorService;
78

89
beforeEach(() => {
9-
TestBed.configureTestingModule({});
10+
TestBed.configureTestingModule({
11+
imports: [
12+
RouterTestingModule.withRoutes([]),
13+
],
14+
});
1015
service = TestBed.inject(IdleMonitorService);
1116
});
1217

projects/scullyio/ng-lib/src/lib/route-service/scully-routes.service.spec.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,23 @@
1+
import {
2+
HttpClientTestingModule,
3+
HttpTestingController,
4+
} from '@angular/common/http/testing';
15
import { TestBed } from '@angular/core/testing';
26

37
import { ScullyRoutesService } from './scully-routes.service';
48

59
describe('ScullyRoutesService', () => {
610
let service: ScullyRoutesService;
11+
let httpTestingController: HttpTestingController;
712

813
beforeEach(() => {
9-
TestBed.configureTestingModule({});
14+
TestBed.configureTestingModule({
15+
imports: [
16+
HttpClientTestingModule,
17+
],
18+
});
1019
service = TestBed.inject(ScullyRoutesService);
20+
httpTestingController = TestBed.inject(HttpTestingController);
1121
});
1222

1323
it('should be created', () => {

projects/scullyio/ng-lib/src/lib/scully-content/scully-content.component.spec.ts

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,30 @@
1+
import {
2+
HttpClientTestingModule,
3+
HttpTestingController,
4+
} from '@angular/common/http/testing';
15
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
6+
import { RouterTestingModule } from '@angular/router/testing';
27

38
import { ScullyContentComponent } from './scully-content.component';
49

510
describe('ScullyContentComponent', () => {
611
let component: ScullyContentComponent;
712
let fixture: ComponentFixture<ScullyContentComponent>;
13+
let httpTestingController: HttpTestingController;
814

915
beforeEach(async(() => {
1016
TestBed.configureTestingModule({
11-
declarations: [ ScullyContentComponent ]
17+
declarations: [ScullyContentComponent],
18+
imports: [
19+
HttpClientTestingModule,
20+
RouterTestingModule.withRoutes([]),
21+
],
1222
})
13-
.compileComponents();
23+
.compileComponents();
1424
}));
1525

1626
beforeEach(() => {
27+
httpTestingController = TestBed.inject(HttpTestingController);
1728
fixture = TestBed.createComponent(ScullyContentComponent);
1829
component = fixture.componentInstance;
1930
fixture.detectChanges();

0 commit comments

Comments
 (0)