I am trying to implement a test with zombie version 6.1.4 in a react js application.
The application at the time of login makes a request for an external API through the axios and if the login is ok the user is redirected to the administrative area.
My test is failing when the user is invalid and the API returns me the status of the 401 request.
H:\newVersionProject\mi-web-frontend\node_modules\react-scripts\scripts\test.js:20
throw err;
^
StatusCodeError: 401 - "{\n \"message\": \"Invalid credentials\"\n}\n"
at new StatusCodeError (H:\newVersionProject\mi-web-frontend\node_modules\request-promise-core\lib\errors.js:32:15)
at Request.plumbing.callback (H:\newVersionProject\mi-web-frontend\node_modules\request-promise-core\lib\plumbing.js:104:33)
at Request.RP$callback [as _callback] (H:\newVersionProject\mi-web-frontend\node_modules\request-promise-core\lib\plumbing.js:46:31)
at Request.self.callback (H:\newVersionProject\mi-web-frontend\node_modules\request\request.js:185:22)
at emitTwo (events.js:126:13)
at Request.emit (events.js:214:7)
at Request.<anonymous> (H:\newVersionProject\mi-web-frontend\node_modules\request\request.js:1161:10)
at emitOne (events.js:116:13)
at Request.emit (events.js:211:7)
at IncomingMessage.<anonymous> (H:\newVersionProject\mi-web-frontend\node_modules\request\request.js:1083:12)
at Object.onceWrapper (events.js:313:30)
at emitNone (events.js:111:20)
at IncomingMessage.emit (events.js:208:7)
at endReadableNT (_stream_readable.js:1064:12)
at _combinedTickCallback (internal/process/next_tick.js:139:11)
at process._tickCallback (internal/process/next_tick.js:181:9)
npm ERR! Test failed. See above for more details.
I am trying to implement a test with zombie version 6.1.4 in a react js application.
The application at the time of login makes a request for an external API through the axios and if the login is ok the user is redirected to the administrative area.
My test is failing when the user is invalid and the API returns me the status of the 401 request.
Below the test code:
When the user exists the test works normally
Thank you