-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
workflow-diagram:Restore missing file
????
- Loading branch information
1 parent
d1cd9c1
commit 75fa8ec
Showing
2 changed files
with
33 additions
and
1 deletion.
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 |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { Job } from '../src/types'; | ||
import { readFile, writeFile } from 'node:fs/promises'; | ||
|
||
export async function getFixture<T>(name: string): Promise<T> { | ||
return JSON.parse(await readFile(`test/fixtures/${name}.json`, 'utf-8')); | ||
} | ||
|
||
export async function setFixture<T>(name: string, data: T): Promise<void> { | ||
await writeFile(`test/fixtures/${name}.json`, JSON.stringify(data, null, 2)); | ||
} | ||
|
||
export function OnFailJob(upstreamJob: Job, attrs: { name: string }): Job { | ||
return { | ||
id: attrs.name.toLowerCase().replace(/[?\W]+/g, '-'), | ||
adaptor: '@openfn/[email protected]', | ||
enabled: true, | ||
trigger: { type: 'on_job_failure', upstreamJob: upstreamJob.id }, | ||
workflowId: 'workflow-one', | ||
...attrs, | ||
}; | ||
} | ||
|
||
export function WebhookJob(attrs: { name: string; [key: string]: any }): Job { | ||
return { | ||
id: attrs.name.toLowerCase().replace(/[?\W]+/g, '-'), | ||
adaptor: '@openfn/[email protected]', | ||
enabled: true, | ||
trigger: { type: 'webhook' }, | ||
workflowId: 'workflow-one', | ||
...attrs, | ||
}; | ||
} |
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