Questions tagged [angular2-testing]

289 questions
0
votes
1 answer

Angular2 testing with Jasmine. How to load dependencies correctry?

I have very simple test. It works. describe('Parser', () => { it('getData works properly', () => { expect(1).toEqual(1); }); }); I'm trying to load corresponding dependencies. But it don't works: import {beforeEachProviders} from…
Nick
  • 9,735
  • 7
  • 59
  • 89
0
votes
1 answer

Angular 2 beforeEachProviders fail with Injector in tests

When I try to pass Injector to the beforeEachProviders in tests I get the following error. Failed: Cannot resolve all parameters for 'Injector'(?, ?, ?, ?, ?). Make sure that all the parameters are decorated with Inject or have valid type…
VuesomeDev
  • 4,095
  • 2
  • 34
  • 44
-1
votes
1 answer

How to test angular2 component with injected service

I folowed official documentation but i still get some errors regarding that some elements appear to be null. //test it('should welcome the user', () => { fixture.detectChanges(); //constcontentel.textContent; …
-1
votes
1 answer

http.post is not a function error while testing angular2 service with karma+jasmine

I am trying to test my angular2 service by using the mockbackend, but I keep getting this error for my http.post service request. Here is the error:enter image description here My service code is : @Injectable() export class AuthService…
VDK
  • 3
  • 1
  • 3
1 2 3
19
20