13,390
questions
0
votes
0
answers
8
views
VsCode Karma DEBUG RUNNER freezes if there's a breakpoint
This problem only just started recently, and I work on a shared project so I'm not sure what might have happened that could have caused this.
However when unit testing our angular project, I can run ...
1
vote
1
answer
17
views
Angular / Jasmine Error Messages are not the same--Quoted?
I am trying to run a test using Angular/Jasmine.
Here is my function:
ValidateX(value : number) {
if (value > 5) {
throw new Error('Number is greater than 5');
}
} ...
1
vote
1
answer
27
views
How do I test ngOnInit in Angular?
I'm using Angular and Jasmine. I've coded an edit form for an entity called a trainer. My ngOnInit function grabs the trainer id from the url and then makes a service call to grab the trainer from the ...
0
votes
1
answer
21
views
fControl.get is not a function in angular unit test
Trying to write an unit test for changeFunctionalityStatus(). facing the issue like fControl.get is not a function .
Stuck with this Anyone pls help me why this issue coming. TIA
...
1
vote
1
answer
24
views
ERROR mocking getAllAccounts method with Jasmine and MsalService - Angular
I am facing issues with test-coverage using jasmine, for that I am working with MsalService-Entra (Microsoft Authentication Library) and Angular 15, I am using a method to get All user accounts from a ...
2
votes
1
answer
49
views
TypeError: Cannot read properties of undefined (reading 'push') in Angular Material Dialog Testing
The previous answers to this question do not resolve my issue.
I'm encountering a TypeError while testing a method in my Angular component that opens a dialog to delete a user. The error message ...
0
votes
1
answer
35
views
How to test an Angular service with inner subscriptions?
I have an angular 18 service which I am trying to unit test. I have a setSelected method that a consumer simply calls, and it will update the subject when it's ready
@Injectable({ providedIn: 'root' })...
1
vote
0
answers
10
views
Error: No value accessor for form control with unspecified name attribute in Jasmine and karma tests with angular
I'm having this message in 20 of my tests that worked perfectly before:
Error: No value accessor for form control with unspecified name attribute
All test are failing with angular, jasmine and karma.
...
1
vote
0
answers
27
views
Mocking Kendo UI for jQuery modules using jasmine
i am new to Kendo UI for jQuery and trying to write unit tests to a class which is something like below.
define('abc', [], () => {
const listOfFunctions = {
formatName(name) {
return ...
1
vote
1
answer
26
views
Jasmine angular testing async promise
I need test an asyncronus promise in Jasmin and I don't know how to do it becase angular return an error every time.
myService.ts
async getNewContext(): Promise<IContext> {
const test1 = ...
-1
votes
0
answers
30
views
jasmine javascript testing library
Why does the browser does not show the tests which i tested
on my html I loaded the script type but the browser still showed a blank page and yet i have done all the imports .I loaded this on my html
...
1
vote
1
answer
31
views
Testing service returning error from http.get
I have this service:
@Injectable({providedIn: 'root'})
export class CaseManagementService {
constructor(private http: HttpService) {
}
getDocumentDetails(caseId: string, docId: string): ...
0
votes
0
answers
109
views
angular 17 + jasmine + karma: Uncaught ReferenceError: require is not defined
Just like the title says, the require is not defined error keeps popping up and is preventing me from processing my unit test.
Here's my karma.conf.js file:
// Karma configuration file, see link for ...
0
votes
0
answers
53
views
Spying on super class methods in Angular Unit Test with Jasmine/Karma
I am writing unit tests for an Angular component class that extends DualListComponent. The subclass, CustomDualListComponent, has a method onClickElement that calls a couple of super class methods ...
1
vote
0
answers
37
views
How to mock window.location in jasmine and preact unit testing
How to mock window.location in jasmine unit testing?
onDeleteConfirm is main function:(After adding the window.location the test case was not working.)
Here how to mock or spy the window.location in ...