Skip to content

Commit 633be83

Browse files
committed
test(sim-cli): drop the check of scripting.mdx exit tables, now generated from the same rows
1 parent 172a3af commit 633be83

1 file changed

Lines changed: 0 additions & 43 deletions

File tree

‎packages/sim-cli/src/commands/protocol/source-exit-codes.test.ts‎

Lines changed: 0 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -24,27 +24,6 @@ const WORKFLOW_SDK_README = readFileSync(
2424
'utf8'
2525
)
2626

27-
const SCRIPTING_DOCS = readFileSync(
28-
join(import.meta.dirname, '../../../../../apps/docs/content/docs/cli/scripting.mdx'),
29-
'utf8'
30-
)
31-
32-
/** The codes of each `| Code | <commands> |` table in the scripting docs, by its header cell. */
33-
const DOCS_TABLES = new Map(
34-
SCRIPTING_DOCS.split(/\n\s*\n/).flatMap((block) => {
35-
const header = block.match(/^\| Code \| (.+) \|$/m)
36-
if (!header) return []
37-
const codes = [...block.matchAll(/^\| `(\d+)` \|/gm)].map((match) => Number(match[1]))
38-
return [[header[1], codes] as const]
39-
})
40-
)
41-
42-
function docsTable(heading: string): number[] {
43-
const codes = DOCS_TABLES.get(heading)
44-
if (!codes) throw new Error(`scripting.mdx has no exit-code table headed ${heading}`)
45-
return codes
46-
}
47-
4827
describe('the exit-code tables an agent or a reader relies on', () => {
4928
it.each([
5029
['the workflow directory guide', WORKFLOW_TREE.agents],
@@ -56,28 +35,6 @@ describe('the exit-code tables an agent or a reader relies on', () => {
5635
})
5736
})
5837

59-
describe('the exit-code tables of the CLI scripting docs', () => {
60-
it.each([
61-
['workflows source apply', '`sim workflows source apply` or `create`'],
62-
['workflows source create', '`sim workflows source apply` or `create`'],
63-
['workflows source get', '`sim workflows source get --dir` or `sim workspaces source get`'],
64-
['workspaces source get', '`sim workflows source get --dir` or `sim workspaces source get`'],
65-
['workspaces source apply', '`sim workspaces source apply`'],
66-
] as const)('list every code %s names in its --help', (command, heading) => {
67-
const help = sourceExitCodesHelp(command).replace(/\s+/g, ' ')
68-
const named = [...help.matchAll(/(?:: |; )(\d+) /g)].map((match) => Number(match[1]))
69-
expect(named.length).toBeGreaterThan(0)
70-
expect(docsTable(heading)).toEqual(expect.arrayContaining(named))
71-
})
72-
73-
it('name only codes a source command exits with', () => {
74-
const sourceTables = [...DOCS_TABLES].filter(([heading]) => heading.includes(' source '))
75-
expect(sourceTables.length).toBeGreaterThanOrEqual(5)
76-
for (const [, codes] of sourceTables)
77-
expect(SOURCE_EXIT_CODES).toEqual(expect.arrayContaining(codes))
78-
})
79-
})
80-
8138
describe('the exit codes a get names in its --help', () => {
8239
it.each(['workflows source get', 'workspaces source get'] as const)(
8340
'%s names exit 13 for a missing or refused login',

0 commit comments

Comments
 (0)