-
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.
version: [email protected] [email protected]
* feat: allow function calls on lazy state * tests: integration tests for lazy-state * version: [email protected] [email protected] --------- Co-authored-by: Joe Clark <[email protected]>
- Loading branch information
1 parent
c2aedec
commit f77a958
Showing
18 changed files
with
148 additions
and
8 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
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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
export default { | ||
extensions: { | ||
ts: 'module', | ||
}, | ||
|
||
environmentVariables: { | ||
TS_NODE_TRANSPILE_ONLY: 'true', | ||
}, | ||
|
||
nodeArguments: ['--loader=ts-node/esm', '--no-warnings', '--experimental-vm-modules'], | ||
|
||
files: ['test/**/*test.ts'], | ||
}; |
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 |
---|---|---|
@@ -1,7 +1,7 @@ | ||
{ | ||
"name": "@openfn/integration-tests-execute", | ||
"private": true, | ||
"version": "1.0.10", | ||
"version": "1.0.11", | ||
"description": "Job execution tests", | ||
"author": "Open Function Group <[email protected]>", | ||
"license": "ISC", | ||
|
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 |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import test from 'ava'; | ||
import execute from '../src/execute'; | ||
|
||
test.serial( | ||
'use lazy-state in template literal & property access', | ||
async (t) => { | ||
const state = { | ||
keyName: 'someKey', | ||
firstName: 'John', | ||
lastName: 'Doe', | ||
}; | ||
const job = ` | ||
fnIf(\`$\{$.keyName\}\` === 'someKey', state => { | ||
state.literal = true; | ||
return state; | ||
}) | ||
fnIf($.firstName + $['lastName'] === 'JohnDoe', state=> { | ||
state.concat = true; | ||
return state; | ||
})`; | ||
|
||
const result = await execute(job, state); | ||
t.is(result.literal, true); | ||
t.is(result.concat, true); | ||
} | ||
); | ||
|
||
test.serial('state function called with lazy-state', async (t) => { | ||
const state = { data: {} }; | ||
|
||
const job = ` | ||
fn((state) => { | ||
state.callMeMaybe = (value) => { | ||
state.data.greetings = "Hello " + value | ||
return state; | ||
} | ||
return state | ||
}); | ||
fn(state => { | ||
state.data.name = "John" | ||
return state; | ||
}) | ||
fn($.callMeMaybe($.data.name))`; | ||
|
||
const result = await execute(job, state); | ||
|
||
t.deepEqual(result, { data: { name: 'John', greetings: 'Hello John' } }); | ||
}); |
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
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 |
---|---|---|
@@ -1,7 +1,7 @@ | ||
{ | ||
"name": "@openfn/integration-tests-worker", | ||
"private": true, | ||
"version": "1.0.68", | ||
"version": "1.0.69", | ||
"description": "Lightning WOrker integration tests", | ||
"author": "Open Function Group <[email protected]>", | ||
"license": "ISC", | ||
|
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
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
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
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"name": "@openfn/compiler", | ||
"version": "0.4.1", | ||
"version": "0.4.2", | ||
"description": "Compiler and language tooling for openfn jobs.", | ||
"author": "Open Function Group <[email protected]>", | ||
"license": "ISC", | ||
|
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
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
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
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
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 |
---|---|---|
@@ -1,5 +1,11 @@ | ||
# @openfn/lightning-mock | ||
|
||
## 2.0.26 | ||
|
||
### Patch Changes | ||
|
||
- @openfn/engine-multi@1.4.5 | ||
|
||
## 2.0.25 | ||
|
||
### Patch Changes | ||
|
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
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
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