Jest throws “Exceeded timeout of 5000 ms” for a very simple test, this is the test code:
'use strict';
const request = require('supertest');
const app = require('./app.js'); // Link to your server file
test('Gets the test endpoint', done => {
// Sends GET Request to /test endpoint
return request(app)
.get('/search/')
.expect(200)
})
this is the server side code:
app.get('/search', function(req, res) {
const rawdata = fs.readFileSync('questions.json');
const questions = JSON.parse(rawdata);
res.status(200).send(questions);
});
any help greatly appreciated