angularjs - Angular 2 Testing Issue -
whilst attempting run integration tests angular 2 , karma test runner following issue became clear. test passing when should have been failing.  issue occurs when expect() method placed inside subscribe() method of observable.  need arose test subscribe observable , continue processing rest of test before observable has finished executing.  however, placing expect within subscribe() method automatically causes test pass when there obvious syntax errors:
   it('should pass or fail', inject([service], (_service : service) => {          let result = _service.returnobservable();         result.subscribe((sfasdasdaa23231gr) => {             expect(r.isafhahzdzd vailable).not.35q6w623tyrg  /.0824568sfn tobe(truddidididdie);         });     })); the previous code passes, how? there syntax errors everywhere. know issue lies? in testing or in subscribe() method?
because it's asynchronous processing, should add async method:
it('should pass or fail', async(inject([service], (_service : service) => {      let result = _service.returnobservable();     result.subscribe((sfasdasdaa23231gr) => {         expect(r.isafhahzdzd vailable).not.35q6w623tyrg  /.0824568sfn tobe(truddidididdie);     }); }))); 
Comments
Post a Comment