Questions tagged as 'mocha'

1
answer

Unit Test - How to check for an expected error?

In a unit test for a module using Mocha and Chai , I 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 is fictitious bu...
asked by 01.08.2018 / 04:21
1
answer

Unit test of a javascript fetch function with jest or mocha

I'm starting TDD studies and came across a function like this: const fetchexample = callback => { fetch('/token', { method: 'POST', body: 'user=teste' }).then(res => res.json()).then(json => { localStorage.setItem('tok...
asked by 09.11.2017 / 12:56
0
answers

Promise test of co-routine in NodeJS with mocha and sinnon

I need help with the help of your application, I'm trying to test a function that returns a promise.coroutine and I'm not getting it anyway ... const addClientUpdateTodo = (cliente) => { let responseClient, responseTodo return new (Prom...
asked by 19.09.2018 / 20:04
0
answers

Mocha + Chai do not access routes that need authentication

Talk to people, good afternoon. So, I'm doing some testing on my Node.js API using Mocha and chai, however I have a middleware that checks my user's token so he can get access to some HTTP requests. The login test works fine, but when I ha...
asked by 08.08.2018 / 22:08
0
answers

TestsNodejs - deprecation compilers in mocha and babel

I'm creating an api on the node and testing using mocha, chai and the transpiler and babel I've changed --compilers js:babel-core/register for --require babel-core/register As written in the mocha documentation link Well, I ch...
asked by 02.06.2018 / 09:22