Skip to content

Commit

Permalink
integration-tests: new test for http adaptor
Browse files Browse the repository at this point in the history
  • Loading branch information
josephjclark committed Nov 13, 2023
1 parent 0d3b3eb commit c07d7d3
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions integration-tests/worker/test/integration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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/[email protected]',
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!)
Expand Down

0 comments on commit c07d7d3

Please sign in to comment.