diff --git a/integration-tests/worker/test/integration.test.ts b/integration-tests/worker/test/integration.test.ts index c9ba22c1f..e4e13afe6 100644 --- a/integration-tests/worker/test/integration.test.ts +++ b/integration-tests/worker/test/integration.test.ts @@ -259,6 +259,43 @@ test('run a job with initial state (no top level keys)', (t) => { }); }); +test('run a http adaptor job', (t) => { + return new Promise(async (done) => { + const attempt = { + id: crypto.randomUUID(), + jobs: [ + { + adaptor: '@openfn/language-http@5.0.4', + body: 'get("https://jsonplaceholder.typicode.com/todos/1");', + }, + ], + }; + + initLightning(); + + lightning.on('attempt:complete', () => { + const result = lightning.getResult(attempt.id); + + t.truthy(result.response); + t.is(result.response.status, 200); + t.truthy(result.response.headers); + + t.deepEqual(result.data, { + userId: 1, + id: 1, + title: 'delectus aut autem', + completed: false, + }); + + done(); + }); + + await initWorker(); + + lightning.enqueueAttempt(attempt); + }); +}); + // TODO this sort of works but the server side of it does not // Will work on it more // TODO2: the runtime doesn't return config anymore (correctly!)