diff --git a/source/as-promise/index.ts b/source/as-promise/index.ts index 86f0e250a..049aab0e3 100644 --- a/source/as-promise/index.ts +++ b/source/as-promise/index.ts @@ -99,6 +99,10 @@ export default function asPromise(firstRequest: Request): CancelableRequest }); }); +test('throws if afterResponse returns an invalid value', withServer, async (t, server, got) => { + server.get('/', echoHeaders); + + await t.throwsAsync(got('', { + hooks: { + afterResponse: [ + // @ts-expect-error + () => {} + ] + } + }), { + message: 'The `afterResponse` hook returned an invalid value' + }); +}); + test('catches afterResponse thrown errors', withServer, async (t, server, got) => { server.get('/', echoHeaders); diff --git a/test/pagination.ts b/test/pagination.ts index 44913302c..a5bb36053 100644 --- a/test/pagination.ts +++ b/test/pagination.ts @@ -716,7 +716,7 @@ test('calls init hooks on pagination', withServer, async (t, server) => { test('throws when transform does not return an array', withServer, async (t, server) => { server.get('/', (_request, response) => { - response.end(JSON.stringify("")); + response.end(JSON.stringify('')); }); await t.throwsAsync(got.paginate.all(server.url));