I like the ability to pass a completed callback when unittest explicitly controls when unittest is considered complete. Can someone explain how this can be combined with dependency injection when using Angular 2?
Some more background:
A normal unittest with a callback function is as follows:
it('should work with done', (done: Function) => { setTimeout(() => { a.test(); }, 1000); a.test = () => { console.log('zweiter test'); expect(true).toBeFalsy(); done(); };
The Unittest created by the Angular 2 framework uses injection and looks like this:
it('should be defined', inject([TxparserService], (service: TxparserService) => { expect(service).toBeTruthy(); }));
I want to use both a callback function and dependency injection. What does it look like?
source share