Skip to content

Commit 40d988f

Browse files
committed
test: pin the root-file kind branch of sourceStatus and refuse an empty help parse
A secrets.ts change must meet every server change of its kind, the firstOfKind branch the map rewrite added; the scripting docs case now fails if the help wording stops yielding codes.
1 parent cd4b31d commit 40d988f

2 files changed

Lines changed: 10 additions & 2 deletions

File tree

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ describe('the exit-code tables of the CLI scripting docs', () => {
6666
] as const)('list every code %s names in its --help', (command, heading) => {
6767
const help = sourceExitCodesHelp(command).replace(/\s+/g, ' ')
6868
const named = [...help.matchAll(/(?:: |; )(\d+) /g)].map((match) => Number(match[1]))
69+
expect(named.length).toBeGreaterThan(0)
6970
expect(docsTable(heading)).toEqual(expect.arrayContaining(named))
7071
})
7172

‎packages/workspace-code/src/status.test.ts‎

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,22 @@ describe('localResourceChanges', () => {
2222

2323
describe('sourceStatus', () => {
2424
it('meets many server changes with many local files in linear time', () => {
25-
const local = localResourceChanges(changedFiles(100))
25+
const local = localResourceChanges([
26+
...changedFiles(100),
27+
{ path: 'secrets.ts', change: 'edited' as const },
28+
])
2629
expect(
2730
sourceStatus(local, [
2831
{ kind: 'file', key: 'f7.txt', server: 'changed' },
2932
{ kind: 'file', key: 'gone.txt', server: 'deleted' },
33+
{ kind: 'secret', key: 'API_KEY', server: 'changed' },
3034
])
3135
).toMatchObject({
3236
state: 'conflict',
33-
conflicts: [{ key: 'f7.txt', change: 'created' }],
37+
conflicts: [
38+
{ key: 'f7.txt', change: 'created' },
39+
{ kind: 'secret', key: 'API_KEY', change: 'edited' },
40+
],
3441
drift: [{ key: 'gone.txt' }],
3542
})
3643
const met = (count: number) => {

0 commit comments

Comments
 (0)