test-workflow-section-sequencing.js 1.9 KB

1234567891011121314151617181920212223242526272829303132
  1. import fs from 'fs';
  2. function assert(condition, message) {
  3. if (!condition) throw new Error(message);
  4. }
  5. const cases = [
  6. ['./.vl-code/workflows/parallel-codegen.json', ['Loop_Services', 'Loop_Components', 'Loop_Sections', 'Loop_Apps']],
  7. ['./public/seed-workflows/parallel-codegen.json', ['Loop_Services', 'Loop_Components', 'Loop_Sections', 'Loop_Apps']],
  8. ['./.vl-code/workflows/meta-direct-codegen.json', ['Loop_Services', 'Loop_Components', 'Loop_Sections', 'Loop_Apps']],
  9. ['./public/seed-workflows/meta-direct-codegen.json', ['Loop_Services', 'Loop_Components', 'Loop_Sections', 'Loop_Apps']],
  10. ['./.vl-code/workflows/3-file-codegen.json', ['Loop_Components', 'Loop_ServiceDomains', 'Loop_Sections', 'Loop_Apps']],
  11. ['./public/seed-workflows/3-file-codegen.json', ['Loop_Components', 'Loop_ServiceDomains', 'Loop_Sections', 'Loop_Apps']],
  12. ['./.vl-code/workflows/6-file-codegen.json', ['Loop_GenVS', 'Loop_GenCP', 'Loop_GenSC', 'Loop_GenVX']],
  13. ['./public/seed-workflows/6-file-codegen.json', ['Loop_GenVS', 'Loop_GenCP', 'Loop_GenSC', 'Loop_GenVX']],
  14. ['./.vl-code/workflows/9-file-codegen.json', ['Loop_GenServiceDomains', 'Loop_GenComponents', 'Loop_GenSections', 'Loop_GenApps']],
  15. ['./public/seed-workflows/9-file-codegen.json', ['Loop_GenServiceDomains', 'Loop_GenComponents', 'Loop_GenSections', 'Loop_GenApps']],
  16. ];
  17. console.log('\n── Workflow Parallel Fanout ──');
  18. for (const [filePath, stepIds] of cases) {
  19. const workflow = JSON.parse(fs.readFileSync(filePath, 'utf-8'));
  20. for (const stepId of stepIds) {
  21. const step = workflow.steps.find(item => item.id === stepId);
  22. assert(step, `${filePath}: missing step ${stepId}`);
  23. assert(step.mode === 'parallel', `${filePath}: ${stepId} should be parallel, got ${step.mode}`);
  24. console.log(`PASS ${filePath} -> ${stepId}=${step.mode}`);
  25. }
  26. }
  27. console.log('PASS test-workflow-section-sequencing.js');