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.
jasmine
13,376
questions
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....
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/...
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 ...
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 ...
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 ...
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, ...
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 ...
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 ...
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 ...
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? ...
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')
....
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"&...
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: ...
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) => {
...
-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 ...