Skip to content

Instantly share code, notes, and snippets.

@wiemKh
wiemKh / profile.service.spec.ts
Last active March 5, 2019 10:43
unit testing service
import { TestBed, async, inject } from '@angular/core/testing';
import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing';
import { HttpClientModule, HttpClient } from '@angular/common/http';
import { ProfileService } from './profile.service';
import { of } from 'rxjs';
describe('ProfileService', () => {
beforeEach(async () => TestBed.configureTestingModule({
providers: [ProfileService],
imports: [HttpClientTestingModule]
}));
@wiemKh
wiemKh / app-routing.module.spec.ts
Created March 5, 2019 10:08
Lazy loading testing
import { async, ComponentFixture, TestBed, fakeAsync, tick } from '@angular/core/testing';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { Router, RouterModule } from '@angular/router';
import { NgModuleFactoryLoader, Component, NgModule } from '@angular/core';
import { RouterTestingModule } from '@angular/router/testing';
import { routes } from './app-routing.module'
import { Location } from '@angular/common';
describe('PageNotfoundComponent', () => {
let component: AppComponent;
let fixture: ComponentFixture<AppComponent>;