Most voted "mocha" questions
7 questions
Sort by count of
-
2
votes1
answer339
viewsUnit test of a javascript fetch function with jest or mocha
I’m starting studies with TDD and came across a function like this: const fetchexample = callback => { fetch('/token', { method: 'POST', body: 'user=teste' }).then(res => res.json()).then(json…
-
1
votes1
answer183
viewsUnit Test - How to verify an expected error?
In a unit test for a module using Mocha and Chai need to check if an error is returned if the parameter format is invalid. The function of the module in question returns a Promise. The example below…
-
1
votes1
answer68
viewsTest error - Chai/Mocha
Hello! I’m studying unit trials with Chai and Mocha. I’ve never touched it before, but now I’m feeling the need to learn about it. I have the following code: module.exports = { //Create - Method…
-
0
votes1
answer88
viewsMocha + Chai do not access routes that require authentication
Talk, y'all, good afternoon. So I’m running some tests on my Node.js API using Mocha and chai, but I have a middleware that checks my user’s token so that it can access some HTTP requirements. The…
-
0
votes1
answer50
viewsHow to create a test for a function with a service inside?
I have the code below and managed to create a test for it, when it enters error 400 and 200. However, I can’t get the test to enter the catch. I’m using Mocha and Chai. myController.approve =…
-
0
votes1
answer80
views -
-2
votes1
answer23
views$ npm test -- --spec=usingPageObjectTest.js does not run the test
Can someone tell me a solution? Running $ npm test -- -spec=usingPageObjectTest.js does not work: [email protected] test C:\wagner.galvao\node\webdriverioframework wdio wdio.conf.js…