Skip to main content

Questions tagged [jasmine]

Jasmine is a behavior-driven development (BDD) framework for testing JavaScript code. Jasmine has no external dependencies and does not require a DOM.

0 votes
1 answer
19 views

How to write unit test case using Jamine to test form controls touched, untouched and dirty conditions

I have a form built using reactive forms angular and I have the below code. The entire if conditions says , branch not covered, how can i make sure the branch is covered. this.tableOptions.rowData....
Nancy's user avatar
  • 989
0 votes
0 answers
11 views

How to use relative paths in SCSS URLs which work for Angular application and karma builds

I've migrated a project to Angular 18 using @angular-devkit/build-angular:application as builder. During the migration process all relative paths in SCSS image URLs have been changed from "~/src/...
Ulrich Wengert's user avatar
1 vote
0 answers
19 views

Karma Test Fails with Chrome For Testing Browser

I am trying to execute the karma-jasmine test case by using Chrome For Testing browser. If I execute the test with Installed Chrome browser then the test works fine, but if same test get executed with ...
Yogesh's user avatar
  • 175
0 votes
1 answer
27 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
17 views

Intelli sense for Jasmine stopped working in VSCode

Yesterday, hovering expect and other jasmine functions gave me suggestions. Today, it does not. I tried restarting and updating, it is still a problem. I found this question, which suggest it should ...
Tomáš Zato's user avatar
  • 52.1k
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
0 votes
1 answer
49 views

Angular reCaptcha V2 Token Testing

I'm new to Angular and I'm trying to get the reCaptcha token in a test. How can I emulate click on the re-capture 'I am not a robot box' or something similar and logging the token response in a test? ...
phebus's user avatar
  • 11
0 votes
1 answer
20 views

How can i write jasmine unit tests for document visibility changed event

I am subscribing for the document's visibilityChanged event.Below is the code. Document is injected using dependency injection. ngOnInit(){ fromEvent(document, 'visibilitychange') ....
Niranjan's user avatar
1 vote
2 answers
21 views

Angular Radio Group [(ngModel)] value not updating in jasmine test

I have this html code in my component <mat-radio-group aria-label="Select an option" [(ngModel)]="searchType" (change)="changeSearchType()" class="form-row"&...
Christèle Legeard's user avatar
1 vote
1 answer
21 views

Jasmine + Karma Error: Invalid configuration of route '...' One of the following must be provided: component, redirectTo, children or loadChildren

I have this component defined inside its own routing-module file, like this: { path: '', redirectTo: 'list', pathMatch: 'full' }, { path: 'list', component: ...
gigio123's user avatar
0 votes
1 answer
44 views

Angular 17 testing mapbox

In my component I display a message after the map style was loaded: import * as mapboxgl from 'mapbox-gl'; ... this.map.on('style.load', () => { this.map.loadImage(path, (err, img) => { ...
perotom's user avatar
  • 863
-1 votes
0 answers
14 views

Angular Component Testing

I am trying to mock **VrskModalService **used in this component. But I am failing to mock it by providing in TestBed.configureTestingModule providers. In this component, I noticed VrskModalService is ...
Akhilesh Mishra's user avatar

15 30 50 per page
1
2 3 4 5
892