diff --git a/src/app/home/home.component.spec.ts b/src/app/home/home.component.spec.ts index 2f9714b..b1978af 100644 --- a/src/app/home/home.component.spec.ts +++ b/src/app/home/home.component.spec.ts @@ -1,19 +1,35 @@ +import {APP_BASE_HREF} from '@angular/common'; +import {HttpClientTestingModule, HttpTestingController} from '@angular/common/http/testing'; import {async, ComponentFixture, TestBed, waitForAsync} from '@angular/core/testing'; +import {ApiService} from '../services/api.service'; +import {CacheService} from '../services/cache.service'; +import {MockEnvironment} from '../testing/environment.mock'; import { HomeComponent } from './home.component'; describe('HomeComponent', () => { let component: HomeComponent; let fixture: ComponentFixture; + let httpMock: HttpTestingController; beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ - declarations: [ HomeComponent ] + declarations: [ HomeComponent ], + imports: [ + HttpClientTestingModule, + ], + providers: [ + ApiService, + CacheService, + {provide: 'APP_ENVIRONMENT', useClass: MockEnvironment}, + {provide: APP_BASE_HREF, useValue: '/'}, + ], }) .compileComponents(); })); beforeEach(() => { + httpMock = TestBed.inject(HttpTestingController); fixture = TestBed.createComponent(HomeComponent); component = fixture.componentInstance; fixture.detectChanges(); diff --git a/src/app/services/cache.service.spec.ts b/src/app/services/cache.service.spec.ts new file mode 100644 index 0000000..345e523 --- /dev/null +++ b/src/app/services/cache.service.spec.ts @@ -0,0 +1,20 @@ +import {TestBed} from '@angular/core/testing'; +import {CacheService} from './cache.service'; + +describe('CacheService', () => { + let service: CacheService; + + beforeEach(() => TestBed.configureTestingModule({ + providers: [ + CacheService, + ], + })); + + beforeEach(() => { + service = TestBed.inject(CacheService); + }); + + it('should be created', () => { + expect(service).toBeTruthy(); + }); +}); diff --git a/src/app/services/settings.service.spec.ts b/src/app/services/settings.service.spec.ts new file mode 100644 index 0000000..52ba15a --- /dev/null +++ b/src/app/services/settings.service.spec.ts @@ -0,0 +1,20 @@ +import {TestBed} from '@angular/core/testing'; +import {SettingsService} from './settings.service'; + +describe('SettingsService', () => { + let service: SettingsService; + + beforeEach(() => TestBed.configureTestingModule({ + providers: [ + SettingsService, + ], + })); + + beforeEach(() => { + service = TestBed.inject(SettingsService); + }); + + it('should be created', () => { + expect(service).toBeTruthy(); + }); +});