-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #466 from OpenFn/464-fix-runtime-err
464 fix runtime err
- Loading branch information
Showing
2 changed files
with
62 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -205,7 +205,6 @@ test('run a job with initial state (with data)', (t) => { | |
const result = lightning.getResult(attempt.id); | ||
t.deepEqual(result, { | ||
...initialState, | ||
configuration: {}, | ||
}); | ||
done(); | ||
}); | ||
|
@@ -245,7 +244,6 @@ test('run a job with initial state (no top level keys)', (t) => { | |
t.deepEqual(result, { | ||
...initialState, | ||
data: {}, | ||
configuration: {}, | ||
}); | ||
done(); | ||
}); | ||
|
@@ -261,9 +259,48 @@ 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 | ||
test('run a job with credentials', (t) => { | ||
// TODO2: the runtime doesn't return config anymore (correctly!) | ||
// So this test will fail. I need to get the server stuff working. | ||
test.skip('run a job with credentials', (t) => { | ||
// Set up a little web server to receive a request | ||
// (there are easier ways to do this, but this is an INTEGRATION test right??) | ||
const PORT = 4826; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters