Skip to main content

All Questions

1 vote
1 answer
70 views

How to unit test logic under AG GRID gridApi function forEachNode

Trying to get my unit test coverage for this bit of code: processUpdates(input) { let request = []; this.gridApi.forEachNode(function (node) { // <--- How to mock/spy inside forEachNode ...
null-point-exceptional's user avatar
-4 votes
1 answer
67 views

Is there any way to use Cypress for unit testing functions? (React Framework) [closed]

I am trying to test helper functions of my application using cypress, but I am not sure if it is possible, or how I could make it work. I know cypress it meant to be used for e2e and component testing,...
Sam's user avatar
  • 3
0 votes
1 answer
49 views

How to confirm in Cypress that opnseadragon image is loaded?

I am writing Unit Test for openseadragon react component in Cypress. Is there an option in opneseadragon to know the image is loaded. React component is const { DEV } = import.meta.env; interface ...
Mo.'s user avatar
  • 27k
0 votes
0 answers
281 views

Jest failed because spyOn is still apply

I have a nodejs under nestjs App, i have some testing on Pipe. I follow this type of architecture https://github.com/mguay22/nestjs-mongo/tree/unit-testing/src/users. My test works correctly when i ...
Raphael Rlt's user avatar
0 votes
0 answers
36 views

How to test console command with mocked functions

I'm trying to make tests for my console script. # src/functions.ts const fn1 = () => console.log('fn1'); const fn2 = () => console.log('fn2'); const fnErr = () => console.log('fnErr'); # ...
Dmitry's user avatar
  • 560
0 votes
1 answer
96 views

Custom snapshot serialiser

I'm literally trying 1:1 the test that is in Jest docs for customising the snapshot serialiser: https://jestjs.io/docs/configuration#snapshotserializers-arraystring module.exports = { serialize(val, ...
alfredopacino's user avatar
2 votes
1 answer
184 views

Cypress avoid waiting for background image loading

I am writing a test for a login page: cy.visit(loginUrl); // type username and password cy.get('#user').type(email); cy.get('#password').type(password); cy.get('#submit').click(); But I can see ...
Varun Sukheja's user avatar
0 votes
0 answers
174 views

Cannot use import statement outside a module syntax error during unit testing using enzyme

/*` FAIL src/ApiComponent.test.js ● Test suite failed to run Jest encountered an unexpected token Jest failed to parse a file. This happens e.g. when your code or its dependencies use non-standard ...
sanket borate's user avatar
0 votes
1 answer
413 views

Issue in creaating react jest test case when using chart.js

I have below test case. Please dont read entire code. (Its not necessary). what i am trying to say i wrote atleast 100times, checked with chatgpt, google bard still not able to make this test case ...
rashmi's user avatar
  • 228
0 votes
0 answers
41 views

How to intercept/mock a function called by an eventListener

I am learning about unit testing and I have been implementing it into my current project with success somewhat, using vitest. But I don't really know how to tackle this situation, let's say that I ...
Iván's user avatar
  • 15
0 votes
0 answers
16 views

How can I do a Unit Testing in KnockoutJS with QUnit

I have this ViewModel (short) with KnockoutJS and I need to make a Unit Test using QUnit but I have this error message when i running my test. ViewModel: var modeloContratacion;//NOSONAR define(['...
Ricardo Uriel Leon Niño's user avatar
1 vote
0 answers
286 views

Test case with empty object using jest

In the below code npm run test:cov gives coverage less than 100%. In index.html the single quotes are not covered which appears in yellow that the branch not covered. parsedResponse = (res: string): ...
CodeBox's user avatar
  • 51
0 votes
1 answer
31 views

Mocked third party function returns value, yet still throws error: ENOENT: no such file or directory

Summary When testing my functions, I think I am having trouble properly stubbing a third party library function used within it. My Code I am writing a test suite for this bit of code in the file ...
null-point-exceptional's user avatar
0 votes
2 answers
483 views

How to exclude files for unit test in vue?

I have an issue in a file when I run unit test in vueJs, this file is located in the path "webapp/src/components/fileDownloader/downloaderFile.js" do you know how to avoid this file when I ...
Gonzalo Iván Vázquez Jiménez's user avatar
4 votes
1 answer
7k views

Why do I need waitFor or act instead of just using await in react testing?

I read that act / waitFor is to wait until the DOM is updated. I've also read that Render is synchronous. I assume that I don't need to wrap a Render with act/waitFor as the DOM will always be ...
EBDS's user avatar
  • 1,554

15 30 50 per page
1
2 3 4 5
41