-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathdev.test.ts
More file actions
47 lines (38 loc) · 842 Bytes
/
dev.test.ts
File metadata and controls
47 lines (38 loc) · 842 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
// testing the dev API
// Tests of the REST API
import test from 'ava';
import { setup } from './util';
// @ts-ignore
let server: any;
let close: any;
const port = 3334;
test.before(async () => ({ server, close } = await setup(port)));
test.after(async () => {
await close();
});
test('addProject: add a project from yaml', async (t) => {
const yaml = `
id: my-project
name: My Project
cli:
version: 2
openfn:
uuid: "1234"
workflows:
- name: wf
steps:
- id: a
expression: fn()
adaptor: "@openfn/language-common@latest"
openfn:
uuid: <a>
history:
- cli:ba19e179317f
id: my-workflow
start: webhook`;
await server.addProject(yaml);
const p = server.state.projects['1234'];
t.is(p.id, '1234');
t.truthy(p.workflows.wf);
t.truthy(p.workflows.wf.jobs);
});