Category "jasmine"

After Angular 13 Upgrade, Jasmine Unit Test Fails - Expected one matching request for criteria "Match method: POST, URL: api/x/x-search", found none

After upgrading to Angular 13 from 12, some of the Unit Tests started failing: Error: Expected one matching request for criteria "Match method: POST, URL: api/

Jasmine AG Grid Test case failed

Am trying to write a test for ag grid export method. Here is the component changes export class GridComponent extendsimplements OnInit { gridApi: any; onG

Angular Unit Test for Http Error Interceptor not working

I have following http error interceptor: @Injectable() export class HttpErrorInterceptor implements HttpInterceptor { constructor(private util: UtilService,

Where is npm run looking for the scripts?

When I type "npm run test" in the command line, npm goes to package.json, to the "scripts" section and tries to match "test" there. So far so good. Now, the li

Run Jasmine tests (coupled to DOM/jquery etc) via command line for CI

We have a set of Jasmine tests that run successfully in the local web server. http-server. We would like to run these tests from the command line during the

Unexpected value 'DecoratorFactory' imported by the module 'DynamicTestModule'. Please add a @NgModule annotation

This is my spec file: import { ComponentFixture, TestBed, async } from '@angular/core/testing'; import { By } from '@angular/platform-browser'; im

After update to angular 13 my tests are not running

When trying to run my tests after migrating to angular 13 I get the following error. The tests were running just fine in angular 12. START: 07 02 2022 16:10:25.

Spy on the result of an Observable Subscription with Jasmine

I am Jasmine unit testing an angular component, which uses Observables. My component has this lifecycle hook that I am testing: ngOnInit() { this.dataService.

Enforce one describe per file

The Story: We have a rather big test codebase with Protractor+Jasmine tests. One of the current problems we have is that some of the test/spec files contain

Typescript Build Fails When Adding Angular into Monorepo (Clashing of Jasmine and Jest Types)

Gist I have a Monorepo with solely Typescript packages. When I run tsc --build all packages will be compiled to Javascript. This worked fine until I added a pa

RxJs - lossy zip marble testing

Following this post I've decided to write a marble test for this operator. Here is a basic test: it('Test lossy zip', () => { const a = hot('a---a-

setValue is not a function webdriver io 7

i'm trying to use the function of webdriver io 7 setValue() but I always received the same result. I post my code. This is the page object Home import Page from

Running a single test file

Is there a way to run ng test for a single file instead of for the entire test suite? Ideally, I'd like to get the quickest possible feedback loop when I'm edi

Variable scope in protractor

I am running protractor and jasmine to run unit tests. I need to know the build version of my web app in order to execute different tests. I have declared a v

Unit test for Button with disable

I am trying to write a unit test for a button that has disabled assigned to a boolean. html looks like: <button *ngIf="!data" id="createBtn" mat-button c

Data Type Jasmine

I'm a beginner in angular test with jasmine and i need to test data type(e.g. String, int, etc.) This is my controller, my data is instantiated to null and la

.detectChanges() not working within Angular test

I've been tasked with writing tests for a chat app developed with Angular. Below is the snippet of Angular template code I'm currently writing tests for: <

How jasmine spyOn a generic method

I try to make a spy on a generic method in typescript, but cannot get Jasmine to recognise it. I have code http: HttpClient <- Not proper code, just showin

How to spyOn a global function and return a value in Jasmine

How can I spy on MyFunction and return 2 in Jasmine 2.0? I have the following code that errors on the first line inside shouldPass with: Error: function My

How to write unit test for a service having breakpoint observer?

I have a service having a breakpoint observer. But how we can trigger window resize event for breakpoint observer to cover all branch and lines. export class B