Top "Angular-test" questions

Questions about testing Angular code, addressing either specific issues ("why is this test failing"), test flows ("how to test this async call of my component") or test setup ("how do I mock router in this component test"), integration tests ("how to bypass a proxy to my backend in this angular test"), or possibly test-related questions, such as ("Why does this component work and the test is failing?

Test pipe with dependencies on services

I have a pipe that sanatises HTML as below: import { Pipe, PipeTransform } from '@angular/core'; import { DomSanitizer } from '@…

angular typescript dependency-injection angular2-testing angular-test
When does Jasmine .toHaveBeenCalledWith match the parameters?

I have the following angular service and its jasmine test. The test calls f1() and spies on f2(). The function …

angular typescript jasmine karma-jasmine angular-test
Angular testing - observable pipe is not a function

I want to write a unit test for a photo-upload-mehtod. But I get the Failed: this.task.snapshotChanges(...).pipe is …

angular jasmine rxjs karma-jasmine angular-test
Angular Testing for Angular-Material on Mat-Menu

I'm trying to write a test for my mat-menu in my application's toolbar. When I call button.click() in my …

angular angular-test angular2-material angular-material-6
AsyncTestZoneSpec is needed for the async - Angular

The application was built on Angular v4 and was gradually updated with every release up until now. Currently we're on …

javascript angular unit-testing angular-test
How to write the unit testing for the file upload method in the Angular 7 (or 2+)

I'm trying to write the unit testing for the file upload method in the angular 7. Getting the below error in …

angular karma-jasmine angular-test
Mocking rest calls in functional e2e protractor tests in angular 4 project

We have a huge project and we have written a lot of test cases to cover a lot of real …

angular protractor angular-mock angular-e2e angular-test
Angular How to test @HostListener

I have the following directive. When applied to an input element, it checks for characters and calls preventDefault when the …

angular angular-test
ng run test return error - TypeError: _this.handler.handle is not a function

I created the c3 bar-chart with angular 5.2.0. All are working fine. But I just want to run the test using …

angular karma-jasmine angular5 angular-test
ng test fails in angular universal Error "Incomplete: No specs found, , randomized with seed 48751"

convert angular 7 project into angular universal while running "ng test" command giving error as "Incomplete: No specs found, , randomized with …

angular angular-universal angular-test angular-unit-test