Skip to content

Commit

Permalink
workflow-diagram:Restore missing file
Browse files Browse the repository at this point in the history
????
  • Loading branch information
josephjclark committed Nov 8, 2022
1 parent d1cd9c1 commit 75fa8ec
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 1 deletion.
32 changes: 32 additions & 0 deletions packages/workflow-diagram/test/helpers.ts
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,
};
}
2 changes: 1 addition & 1 deletion packages/workflow-diagram/test/layout.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { toElkNode, toFlow, doLayout } from '../src/layout/index';
import { FlowElkNode, FlowNodeEdges } from '../src/layout/types';
import { getFixture } from './helpers';

test.skip('toElkNode should convert a project space to a workflow', async (t) => {
test('toElkNode should convert a project space to a workflow', async (t) => {
const projectSpace = await getFixture<ProjectSpace>(
'single-workflow-projectspace'
);
Expand Down

0 comments on commit 75fa8ec

Please sign in to comment.