Skip to content

Commit 8870630

Browse files
committed
Corrected tests setup
1 parent ac75ed8 commit 8870630

4 files changed

Lines changed: 9 additions & 16 deletions

File tree

src/app/authentication/interceptor/basic-authentication.interceptor.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ describe('BasicAuthenticationInterceptor', () => {
1010
],
1111
providers: [
1212
BasicAuthenticationInterceptor
13-
]
13+
]
1414
}));
1515

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

src/app/authentication/interceptor/unauthorized.interceptor.spec.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
1+
import { HttpClientTestingModule } from '@angular/common/http/testing';
12
import { TestBed } from '@angular/core/testing';
23

34
import { UnauthorizedErrorInterceptor } from './unauthorized.interceptor';
45

56
describe('UnauthorizedErrorInterceptor', () => {
67
beforeEach(() => TestBed.configureTestingModule({
8+
imports: [
9+
HttpClientTestingModule
10+
],
711
providers: [
812
UnauthorizedErrorInterceptor
9-
]
13+
]
1014
}));
1115

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

src/app/login/containers/logout-button/logout-button.component.spec.ts

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -43,17 +43,4 @@ describe('LogoutButtonComponent', () => {
4343
expect(component).toBeTruthy();
4444
});
4545

46-
it('should be disabled by default', () => {
47-
const button = fixture.nativeElement.querySelector('button');
48-
expect(button.disabled).toEqual(true);
49-
});
50-
51-
it('if the user is logged the button is enabled', () => {
52-
user.logged = true;
53-
fixture.detectChanges();
54-
55-
const button = fixture.nativeElement.querySelector('button');
56-
expect(button.disabled).toEqual(false);
57-
});
58-
5946
});

src/app/navigation/navigation-menu/navigation-menu.component.spec.ts

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

34
import { RouterTestingModule } from '@angular/router/testing';
@@ -11,7 +12,8 @@ describe('NavigationMenuComponent', () => {
1112
await TestBed.configureTestingModule({
1213
declarations: [NavigationMenuComponent],
1314
imports: [
14-
RouterTestingModule
15+
RouterTestingModule,
16+
HttpClientTestingModule
1517
]
1618
}).compileComponents();
1719
});

0 commit comments

Comments
 (0)