Skip to content

Commit

Permalink
compiler: extra promise test
Browse files Browse the repository at this point in the history
  • Loading branch information
josephjclark committed Jul 25, 2024
1 parent 1646812 commit 0519232
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions packages/compiler/test/compile.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -167,3 +167,21 @@ export default [_defer(
const result = compile(source);
t.is(result, expected);
});

test('compile simple promise chain with each', (t) => {
const source = `each(
"$.data[*]",
post("/upsert", (state) => state.data).then((s) => s)
)`;

const expected = `import { defer as _defer } from "@openfn/runtime";
export default [each(
"$.data[*]",
_defer(post("/upsert", (state) => state.data), p => p.then((s) => s))
)];`;

const result = compile(source);
console.log(result);
t.is(result, expected);
});

0 comments on commit 0519232

Please sign in to comment.