Skip to main content

All Questions

Tagged with
-2 votes
1 answer
27 views

ng test for specific module fails [closed]

Running ng test for unit tests set to a specific module fails because it includes tests from other modules. karma version folder structure Image of 'test.ts' file where the test case need to be ...
Betsy M Baby's user avatar
0 votes
1 answer
29 views

Angular Karma/Jasmine Unit Test Cannot Read Properties Of Undefined Readin imageUrl

I have been tackling an error for a couple of days in my unit testing. Everything I have tried thus far from my research does not seem to resolve the issue. Three of my components are failing unit ...
user2280852's user avatar
0 votes
1 answer
28 views

Angular Unit Test - Mocking a function on a property

Updating with some new attempts I've tried several different approaches, and I'm obviously missing something fundamental on how to avoid this error and mock out this function. I've updated the mock ...
Rusty Shackleford's user avatar
1 vote
1 answer
31 views

Angular Unit Testing - Errors on Testing Promise Rejection

I'm trying to make sure the catch block of a function on my service is covered, and I just can't quite get it to work. I've tried a couple of different ways. In version 1, it seems cleaner but I don't ...
Rusty Shackleford's user avatar
1 vote
2 answers
46 views

Angular Unit Testing Service - Property in service constructor not using value from spyOnProperty

I'm trying to write a negative test for my AuthService that a property in the constructor is set to null if nothing is returned from angularFireAuth. The positive side of this test case is working, ...
Rusty Shackleford's user avatar
1 vote
1 answer
40 views

Angular Unit Testing - Setting a Property in Mock to Null (spyOnProperty)

I'm having trouble doing a negative test of an ngIf statement that looks at a property on my authService. I have a mock provider already, and the positive version of this test works great. I can see ...
Rusty Shackleford's user avatar
0 votes
0 answers
25 views

spec.ts is missing from the TypeScript compilation. Please make sure it is in your tsconfig via the 'files' or 'include' property in angular test

Recently I upgraded the angular version from 8 to 14, ng serve and ng builds running fine, while I run unit test cases(ng test), it gives us an error -> spec.ts is missing from the TypeScript ...
Bajrang Singh's user avatar
1 vote
1 answer
20 views

Angular test how to mock an imported const

I have an angular service being tested, which import a const from another file import { environment } from "../environments/environment"; The environment.ts is like export const environment ...
Ricky Mo's user avatar
  • 7,328
0 votes
0 answers
22 views

angular unit test coverage report html is empty

Somehow I have an empty index.html in coverage report folder after running "ng test --code-coverage": I tried once and saw the report html file is filled with each component coverage but ...
Adventitious Angles Qs Poster's user avatar
1 vote
0 answers
35 views

Angular 17 AngularFireModule Not Provided in AppModule' When Executing FirestoreDataService Test Cases with Jasmine and Karma

jasmin-karma error image , import module image import { ErrorHandler } from '@angular/core'; import { TestBed } from '@angular/core/testing'; import { getFirestore, provideFirestore } from '@angular/...
vatsal's user avatar
  • 11
1 vote
1 answer
34 views

Angular testing with material querySelector returns always null

I have an Angular project running with material ui. I am writing unit tests and my problem is to access DOM elements. My component.spec.ts runs fine, except I cannot access HTML elements inside mat-...
Olivier Tisserand's user avatar
1 vote
1 answer
45 views

How to mock variables in a template in a Jest unit test for an Angular application?

I meet a problem in a jest unit test. the code for the html looks jest like this: <ng-container *ngVar="personFacade.personInfo$ | async as personInfo"> @if (personInfo.active){ <...
user1938143's user avatar
  • 1,164
0 votes
0 answers
26 views

Angular Jasmine Unit Testing How To Handle CORS Policy Error

I'm having an issue with CORS blocking on my unit test using Jasmine, I understand the issue but I'm not sure how to fix it. I have handle the CORS issue with my application on the backend ...
user2280852's user avatar
0 votes
1 answer
39 views

Mocking AngularFireAuth for angular service unit testing

I created a service to handle all of my authentication calls to angularFireAuth, but the basic toBeTruthy assertion is hitting an injector error for angularFireAuth. I solved this for several other ...
Rusty Shackleford's user avatar
1 vote
1 answer
35 views

Angular unit test failed due to data in HTML NgModel binded to a service's property not updated

I have a LoginPageComponent with email and password fields whose values areNgModel binded to LoginServices's property loginInfo. LoginPageComponent also has Login button, which is disabled when ...
Dat Le's user avatar
  • 48

15 30 50 per page
1
2 3 4 5
280