Some checks failed
Security: Sync from Public / sync-from-public (push) Has been cancelled
Test: Benchmark Nightly / build (push) Has been cancelled
Test: Benchmark Nightly / Notify Cats on failure (push) Has been cancelled
CI: Python / Checks (push) Has been cancelled
Test: Evals Python / Workflow Comparison Python (push) Has been cancelled
Util: Check Docs URLs / check-docs-urls (push) Has been cancelled
Test: Visual Storybook / Cloudflare Pages (push) Has been cancelled
Test: E2E Performance / build-and-test-performance (push) Has been cancelled
Test: Workflows Nightly / Run Workflow Tests (push) Has been cancelled
Util: Cleanup CI Docker Images / Delete stale CI images (push) Has been cancelled
Test: Benchmark Destroy Env / build (push) Has been cancelled
Util: Update Node Popularity / update-popularity (push) Has been cancelled
Test: E2E Coverage Weekly / Coverage Tests (push) Has been cancelled
86 lines
2.0 KiB
TypeScript
86 lines
2.0 KiB
TypeScript
import { migrateRunExecutionData } from '../../src/run-execution-data/run-execution-data';
|
|
import type { IRunExecutionDataV0 } from '../../src/run-execution-data/run-execution-data.v0';
|
|
import type { IRunExecutionDataV1 } from '../../src/run-execution-data/run-execution-data.v1';
|
|
|
|
describe('migrateRunExecutionData', () => {
|
|
it('should migrate IRunExecutionDataV0 to V1', () => {
|
|
const v0Data: IRunExecutionDataV0 = {
|
|
version: 0,
|
|
startData: {
|
|
startNodes: [],
|
|
destinationNode: 'TestNode',
|
|
originalDestinationNode: 'OriginalTestNode',
|
|
runNodeFilter: ['filter1'],
|
|
},
|
|
resultData: {
|
|
runData: {},
|
|
lastNodeExecuted: 'LastNode',
|
|
metadata: { key: 'value' },
|
|
},
|
|
executionData: {
|
|
contextData: {},
|
|
nodeExecutionStack: [],
|
|
metadata: {},
|
|
waitingExecution: {},
|
|
waitingExecutionSource: null,
|
|
},
|
|
validateSignature: true,
|
|
pushRef: 'test-ref',
|
|
};
|
|
|
|
const result = migrateRunExecutionData(v0Data);
|
|
|
|
expect(result).toEqual({
|
|
...v0Data,
|
|
version: 1,
|
|
startData: {
|
|
...v0Data.startData,
|
|
destinationNode: {
|
|
nodeName: 'TestNode',
|
|
mode: 'inclusive',
|
|
},
|
|
originalDestinationNode: {
|
|
nodeName: 'OriginalTestNode',
|
|
mode: 'inclusive',
|
|
},
|
|
},
|
|
});
|
|
});
|
|
|
|
it('should return V1 data unchanged (no-op)', () => {
|
|
const v1Data: IRunExecutionDataV1 = {
|
|
version: 1,
|
|
startData: {
|
|
startNodes: [],
|
|
destinationNode: {
|
|
nodeName: 'TestNode',
|
|
mode: 'exclusive',
|
|
},
|
|
originalDestinationNode: {
|
|
nodeName: 'OriginalTestNode',
|
|
mode: 'inclusive',
|
|
},
|
|
runNodeFilter: ['filter1'],
|
|
},
|
|
resultData: {
|
|
runData: {},
|
|
lastNodeExecuted: 'LastNode',
|
|
metadata: { key: 'value' },
|
|
},
|
|
executionData: {
|
|
contextData: {},
|
|
nodeExecutionStack: [],
|
|
metadata: {},
|
|
waitingExecution: {},
|
|
waitingExecutionSource: null,
|
|
},
|
|
validateSignature: true,
|
|
pushRef: 'test-ref',
|
|
};
|
|
|
|
const result = migrateRunExecutionData(v1Data);
|
|
|
|
expect(result).toEqual(v1Data);
|
|
});
|
|
});
|