Skip to main content
Filter by
Sorted by
Tagged with
1 vote
1 answer
68 views

Running this unit test in Angular 21 always fails with the following error: × should toggle showSettings when settings button is clicked (440231 ms) ● DrawerComponent › should launch settings ...
bob.mazzo's user avatar
  • 5,817
0 votes
1 answer
72 views

In my Angular app I need to be able to unit test that routerLink create the correct href attribute. Sometimes they are links relative to the current route, and sometimes they are absolute links from ...
Chris Barr's user avatar
  • 34.8k
3 votes
1 answer
1k views

I have a Service which contains a resource (for a list of country-objects). Unit-testing the usual way seems not to work, even with fakeAsync and tick. Changes on the Subject which feeds the request-...
hgoebl's user avatar
  • 13.1k
0 votes
0 answers
42 views

I have a simple Angular 19 component that will make multiple requests for SVG files, and then insert them into a component @Component({ selector: 'app-custom-svg-images', imports: [AsyncPipe], ...
Chris Barr's user avatar
  • 34.8k
-1 votes
1 answer
955 views

I have an application, which was generated with Angular CLI v19 and uses the application builder. The application builds and works perfectly fine, however when running ng test, I get a new error: ...
JSON Derulo's user avatar
  • 19.1k
1 vote
0 answers
82 views

I am trying to create unit test case for the below code, export class TestService { currentContent$ = this.getContent().pipe( distinctUntilChanged((p, c) => isEqual(p, c)) ); ...
Smita's user avatar
  • 11
0 votes
1 answer
449 views

I am trying to test mat snackbar. I have following code in my component.ts snackbarRef: MatSnackBarRef<TextOnlySnackBar>; constructor(private snackBar: MatSnackBar) {} onUpdate(){ this....
StaticName's user avatar
2 votes
1 answer
1k views

After updating my Angular project (including Angular Material) to v19, I am getting new errors like the following in my unit tests: NullInjectorError: R3InjectorError(Standalone[MyComponent])[...
JSON Derulo's user avatar
  • 19.1k
8 votes
2 answers
3k views

I have generated a fresh Angular 18 project and made it zoneless. It works fine, however in all of my unit tests I am now getting the following error: Error: NG0908: In this configuration Angular ...
JSON Derulo's user avatar
  • 19.1k
1 vote
1 answer
387 views

I'm facing this error when I try to run test in an Angular project: NavigationMainComponent › should create TypeError: Cannot read properties of undefined (reading 'subscribe') at ...
Valentina Maronese's user avatar
3 votes
1 answer
2k views

I am using Angular's signal queries (viewChild, viewChildren, contentChild, contentChildren) like the following: export class MyComponent { myScrollContainer = viewChild('scrollContainer', { read: ...
JSON Derulo's user avatar
  • 19.1k
2 votes
0 answers
256 views

I am using Angular signal and to execute change in signal using effect function. How to mock signal to trigger effect during unit test. import { effect, Injector, Signal } from '@angular/core'; ...
Jack Nil's user avatar
0 votes
0 answers
131 views

I am getting following error when ran the unit tests in pipeline for an Angular app. Error: Timeout - Async function did not complete within 5000ms (set by jasmine.DEFAULT_TIMEOUT_INTERVAL) ...
Mahesh Dharwad's user avatar
3 votes
1 answer
10k views

I have an application using Angular 18, and I have one component that uses a service. That service calls HttpClient, gets a list of entities and the component uses that on the constructor. The unit ...
Luiz Gustavo Mendes's user avatar
1 vote
0 answers
2k views

We upgraded our Angular application from version 16 to 18. After the upgrade, our unit tests started failing with the following error: Error: NG0205: Injector has already been destroyed. in http://...
Nirbhay Singh's user avatar
0 votes
1 answer
710 views

I am using ng test to run my unit tests. I have a scenario where I need to test mutliple spec files which are in different paths. I am able to do this using angular.json "test": { ... "...
Naveen kumar S's user avatar
1 vote
0 answers
90 views

Recently, I upgraded my angular project from v14 to v15. But after the upgrade, on running the test suite using the command ng test, I'm getting the following error: I addressed the warning shown in ...
Shubhanshu Singh's user avatar
2 votes
1 answer
108 views

I am new to angular unit testing with jest. And config the project with jest as stated below. After every --clearCache, running a simple unit test takes 500 to 1500 sec. But after the 1st run unit ...
Rajesh Patra's user avatar
2 votes
0 answers
51 views

I've recently added @ContentChildren to one of my components which are reused throughout the whole application and now I can't get rid of unit tests fail. It fails on init with error: An error was ...
Wojciech Jakubek's user avatar
1 vote
0 answers
2k views

I'm trying to unit test one of my components which has regexCtrl = input.required<FormControl<string>>({alias: 'regex'}); After some Googling, this was, more or less, what I thing should ...
Jeanluca Scaljeri's user avatar
0 votes
0 answers
266 views

I have a standalone component with some non-standalone dependencies. These dependencies were added with related modules to the imports array. How can I mock dependencies of non-standalone components ...
Dima Savenkov's user avatar
8 votes
5 answers
2k views

After updating, my previously passing unit tests now fail with the error: 'TypeError: this._renderer.addClass is not a function' across multiple tests, despite not using or importing the renderer in ...
rami-sf's user avatar
  • 451
0 votes
0 answers
58 views

Using below service in my project and unit testing failed due to Range Error and where I used this service that component also failed unit test. Modal.service.ts import { DOCUMENT } from '@angular/...
Gobinath M's user avatar
  • 2,031
1 vote
1 answer
283 views

Currently I am using a service: @Injectable({ providedIn: MyModule }) export class MyService { //... do stuff } --- @NgModule({ declarations: [MyComp], imports: [ ReactiveFormsModule, ...
Rip3rs's user avatar
  • 1,590
1 vote
1 answer
713 views

I have the following test suits import { ComponentFixture, TestBed } from '@angular/core/testing'; import { RouterTestingModule } from '@angular/router/testing'; import { HttpClientTestingModule } ...
Smaillns's user avatar
  • 3,305
0 votes
2 answers
624 views

I am new in angular unit testing; I want to write a unit test for the service that is injected in constructor and is called http in it . but I don't know why globalConfig property is undefined: @...
ali's user avatar
  • 41
1 vote
1 answer
124 views

I am trying to unit test a Login Form, but I am not able to execute it as expected. TestBed configuration: beforeEach(() => { TestBed.configureTestingModule({ imports: [FormsModule], ...
Tony Roczz's user avatar
  • 2,398
0 votes
1 answer
446 views

How can I trigger a select interaction on openlayer map in angular unit testing? below is my select event code. let select = new Select({style: null}); select.set('selectInteraction', 'name'); ...
Prabhakaran's user avatar
  • 1,357
0 votes
1 answer
91 views

Right now we are using karma testing to check for existing buttons in a component, the thing is the component displays the buttons as the child of a child. what we are testing is: ProductNavComponent \...
Gael Gal's user avatar
0 votes
1 answer
78 views

I'm trying to implement a dialog component where user can click escape button to close the popup (I'm using DaisyUI). It works fine when I try it manually, but for some reason I'm not able to create ...
Heila Al-Mogren's user avatar
2 votes
1 answer
1k views

I am writing some component tests for my Nx Angular application using Cypress. I am trying to retrieve an instance of a provider that I set up in my test: export const DASHBOARD_TOKEN = new ...
afriedman111's user avatar
  • 2,491
1 vote
1 answer
1k views

Running NX mono repo and Angular "@nrwl/angular": "15.2.4", "@angular/core": "~15.0.0", "@ngxs/store": "^3.7.6", "jest": "28....
Hadi's user avatar
  • 2,905
1 vote
1 answer
1k views

So I'm attempting to unit test my interceptor with out using testbed. The interceptor merely appends the Auth headers with a bearer token. I can't seem to figure out how to actually check that those ...
Lewis Morgans's user avatar
1 vote
1 answer
839 views

I'm trying to fix my unit tests of a component that subscribes to an Observable of the service DataService during ngOnInit(). However, at the moment I'm still getting TypeError: Cannot read properties ...
LukyFoggy's user avatar
  • 711
2 votes
2 answers
2k views

I have no idea why in my Angular project, Jasmin alwasys return null when I'm trying to access a HTML's element! it('should find the <p> with fixture.debugElement.query(By.css)', () => { ...
Reza Younesi's user avatar
0 votes
1 answer
981 views

I'm trying to unit test an http interceptor. The interceptor is used for authorization. I can test the basic success case, but I'm trying now to test the case where the API call fails because access ...
Mr Smith's user avatar
  • 3,538
0 votes
0 answers
90 views

Im a Angular newbie and starting to write Unit Tests. I have a simple Component, which loads data from RxJs - Subject. Im not able to initialize the spec.ts file for testing does anyone now how to do ...
kayssmile's user avatar
0 votes
2 answers
991 views

This error comes up even with just the boiler plate for the spec file. Is there any other issues causing this? ts file import { Component, OnInit, Input, Output, EventEmitter, ViewContainerRef } from '...
Alen Aju's user avatar
0 votes
2 answers
379 views

I need to test click event on mat-table row. Below is my mat-table code <table mat-table [dataSource]="dataSource" matSort matSortActive="formCode" ...
dakim236's user avatar
0 votes
1 answer
1k views

In my Angular app I have a service which is provided at a component level: @Component({ selector: 'my-component', templateUrl: './my.component.html', providers: [MyService], }) export class ...
Francesco Borzi's user avatar
0 votes
1 answer
191 views

I have a class which use Socket as a private property. import {Socket} from 'socket.io-client'; export class SocketService { private socket: Socket; public initializeSocket() { if(this....
Kerwen's user avatar
  • 562
0 votes
2 answers
942 views

I have a class which has a private property. import {Socket} from 'socket.io-client'; export class SocketService { private socket: Socket; public initializeSocket() { if(this.socket) { ...
Kerwen's user avatar
  • 562
0 votes
2 answers
612 views

Hi I have a function which I would like to unit test. This is my function. let docProcess: IDocProcess; public onCalling(args) { if (this.docProcess.viewMode) { this.makeCalls(args); } }...
Chris's user avatar
  • 3
0 votes
0 answers
566 views

Please find the describe in test file : ` fdescribe('NdelDeviceBalancePayoffComponent', () => { let component: NdelDeviceBalancePayoffComponent; let fixture: ComponentFixture<...
Cleyon Kurian's user avatar
0 votes
1 answer
2k views

I am unable to test else condition in my code as Unable to change value of input(). Please help. Once I pass data in spec.ts unable to assign other data @Input() data: any; ngOnInit(): void { if (...
Orpita's user avatar
  • 11
0 votes
1 answer
123 views

Test cases are running successfully but at the end it gets returned with an Uncaught [object Object] error which looks like this: - Test script: ng test --codeCoverage=true --no-watch --no-progress --...
d1fficult's user avatar
  • 1,103
0 votes
1 answer
223 views

I'm trying to cover this.httpCache.put(this.agreementUrl, agreement as any); line in test but it always fails, public getTransportAgreement(): Observable<TransportAgreement> { const ...
Tobias Foxtrot's user avatar
2 votes
0 answers
418 views

I've written the test case for services where I'm testing Negative and positive scenarios both but giving me errors for the negative scenario. I've written in order first I'm checking the negative ...
Gerry Carod's user avatar
-1 votes
1 answer
752 views

I have implement component communication using emit emitter service. service.ts import { EventEmitter, Injectable } from '@angular/core'; @Injectable({ providedIn: 'root' }) export class ...
Suhail Ahmed's user avatar
0 votes
1 answer
318 views

export interface UserDetails { name: 'string', id: 'string', address: { area: 'string', city: 'string', }} export class UserComponent { Private GetData() { let userDetail: UserDetails = { name: 'user ...
Peri's user avatar
  • 158

1
2 3 4 5 6