Stubs out some tests

This commit is contained in:
Aaron Louie 2020-10-19 12:23:05 -04:00
parent 1a7c551dfa
commit 4ea2109cd8
3 changed files with 57 additions and 1 deletions

View File

@ -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<HomeComponent>;
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();

View File

@ -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();
});
});

View File

@ -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();
});
});