Test particulier réussi mais je reçois ça.
console.log node_modules/jest-jasmine2/build/jasmine/Env.js:502
●
Test suite failed to run
Returning a Promise from "describe" is not supported. Tests must be defined synchronously.
Returning a value from "describe" will fail the test in a future version of Jest.
> 4 | describe('handlers.getSemesters', async () => {
Voici le code de test complet
describe('handlers.getSemesters', async () => {
it('should return an array of Semesters', async () => {
academicCalendarRequest.request = jest.fn();
academicCalendarRequest.request.mockReturnValue([
{
description: 'Semester1',
}
]);
const expected = [
{
description: 'Semester1',
},
];
const handlers = new Handlers();
const actual = await handlers.getSemesters();
expect(actual).toEqual(expected);
});
});
Comment puis-je le réparer?
Changement
describe('handlers.getSemesters', async () => {
À
describe('handlers.getSemesters', () => {
Et puis mettez du code asynchrone à l'intérieur du bloc it
it('should return an array of Semesters', async () => {
// ...
})