Created
May 28, 2020 01:16
-
-
Save Qarun-Qadir-Bissoondial/a4cf290a31724adee7d985bbca6d9b7c to your computer and use it in GitHub Desktop.
Providing mock services
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { async, ComponentFixture, TestBed } from '@angular/core/testing'; | |
import { InventoryComponent } from './inventory.component'; | |
import { InventoryService } from '../inventory.service'; | |
import { MockInventoryService } from 'src/testing/inventory.mock.service'; | |
fdescribe('InventoryComponent', () => { | |
let component: InventoryComponent; | |
let fixture: ComponentFixture<InventoryComponent>; | |
beforeEach(async(() => { | |
TestBed.configureTestingModule({ | |
declarations: [ InventoryComponent ], | |
providers: [ | |
{ provides: InventoryService, useClass: MockInventoryService } | |
] | |
}) | |
.compileComponents(); | |
})); | |
beforeEach(() => { | |
fixture = TestBed.createComponent(InventoryComponent); | |
component = fixture.componentInstance; | |
fixture.detectChanges(); | |
}); | |
it('should create', () => { | |
expect(component).toBeTruthy(); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment