Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 26 additions & 6 deletions test/gh-aw-implement-workflow.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -237,12 +237,32 @@ describe('gh-aw implement workflows', () => {
});

it('documents one-command installation in dependency order', () => {
const workerIndex = guide.indexOf('bradygaster/squad/workflows/squad-implement-worker.md@dev');
const dispatcherIndex = guide.indexOf('bradygaster/squad/workflows/squad.md@dev');

expect(workerIndex).toBeGreaterThan(-1);
expect(dispatcherIndex).toBeGreaterThan(workerIndex);
expect(guide).toContain('The single command installs the dedicated worker first');
const paths = [
'bradygaster/squad/workflows/squad.md@dev',
'bradygaster/squad/workflows/squad-implement-worker.md@dev',
'bradygaster/squad/workflows/squad-review.md@dev',
];
const orderedInstallCommand = [
'gh aw add \\',
` ${paths[0]} \\`,
` ${paths[1]} \\`,
` ${paths[2]}`,
].join('\n');
const normalizedGuide = guide.replace(/\r\n/g, '\n');
const hasOrderedInstallCommand = (markdown: string): boolean =>
[...markdown.matchAll(/```bash\n([\s\S]*?)\n```/g)]
.some(match => match[1].includes(orderedInstallCommand));

expect(hasOrderedInstallCommand(normalizedGuide)).toBe(true);

const reorderedGuide = normalizedGuide.replaceAll(
`${paths[0]} \\\n ${paths[1]}`,
`${paths[1]} \\\n ${paths[0]}`,
);
expect(hasOrderedInstallCommand(reorderedGuide)).toBe(false);
expect(guide).toMatch(
/Keep the dispatcher first\. `gh aw add` discovers its implementation-worker and\s+reviewer dependencies while compiling it; the explicit worker and reviewer\s+entries then confirm the complete install surface without creating duplicates\./,
);
});
});

Expand Down