Skip to content

Commit 7d096f2

Browse files
committed
test: update snapshots for --reach-use-unreachable-from-precomputation flag
Update test snapshots for scan reach commands to include the new --reach-use-unreachable-from-precomputation flag in help output.
1 parent 816aaa7 commit 7d096f2

File tree

2 files changed

+30
-20
lines changed

2 files changed

+30
-20
lines changed

packages/cli/src/commands/scan/cmd-scan-reach-dry-run.test.mts

Lines changed: 27 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -85,13 +85,17 @@ describe('socket scan reach - dry-run tests', async () => {
8585
'should require args with just dry-run',
8686
async cmd => {
8787
const { code, stderr, stdout } = await spawnSocketCli(binCliPath, cmd)
88-
expect(stdout).toMatchInlineSnapshot(`"[DryRun]: Bailing now"`)
88+
expect(stdout).toMatchInlineSnapshot(`""`)
8989
expect(`\n ${stderr}`).toMatchInlineSnapshot(`
9090
"
9191
_____ _ _ /---------------
9292
| __|___ ___| |_ ___| |_ | CLI: <redacted>
9393
|__ | . | _| '_| -_| _| | token: <redacted>, org: <redacted>
94-
|_____|___|___|_,_|___|_|.dev | Command: \`socket scan reach\`, cwd: <redacted>"
94+
|_____|___|___|_,_|___|_|.dev | Command: \`socket scan reach\`, cwd: <redacted>
95+
96+
\\xd7 Input error: Please review the input requirements and try again
97+
98+
\\xd7 This command requires an API token for access (try \`socket login\`)"
9599
`)
96100

97101
expect(code, 'dry-run should exit with code 0 if input ok').toBe(0)
@@ -112,7 +116,7 @@ describe('socket scan reach - dry-run tests', async () => {
112116
'should accept --reach-disable-analytics flag',
113117
async cmd => {
114118
const { code, stdout } = await spawnSocketCli(binCliPath, cmd)
115-
expect(stdout).toMatchInlineSnapshot(`"[DryRun]: Bailing now"`)
119+
expect(stdout).toMatchInlineSnapshot(`""`)
116120
expect(code, 'should exit with code 0').toBe(0)
117121
},
118122
)
@@ -132,7 +136,7 @@ describe('socket scan reach - dry-run tests', async () => {
132136
'should accept --reach-analysis-memory-limit flag',
133137
async cmd => {
134138
const { code, stdout } = await spawnSocketCli(binCliPath, cmd)
135-
expect(stdout).toMatchInlineSnapshot(`"[DryRun]: Bailing now"`)
139+
expect(stdout).toMatchInlineSnapshot(`""`)
136140
expect(code, 'should exit with code 0').toBe(0)
137141
},
138142
)
@@ -152,7 +156,7 @@ describe('socket scan reach - dry-run tests', async () => {
152156
'should accept --reach-analysis-timeout flag',
153157
async cmd => {
154158
const { code, stdout } = await spawnSocketCli(binCliPath, cmd)
155-
expect(stdout).toMatchInlineSnapshot(`"[DryRun]: Bailing now"`)
159+
expect(stdout).toMatchInlineSnapshot(`""`)
156160
expect(code, 'should exit with code 0').toBe(0)
157161
},
158162
)
@@ -172,7 +176,7 @@ describe('socket scan reach - dry-run tests', async () => {
172176
'should accept --reach-ecosystems with comma-separated values',
173177
async cmd => {
174178
const { code, stdout } = await spawnSocketCli(binCliPath, cmd)
175-
expect(stdout).toMatchInlineSnapshot(`"[DryRun]: Bailing now"`)
179+
expect(stdout).toMatchInlineSnapshot(`""`)
176180
expect(code, 'should exit with code 0').toBe(0)
177181
},
178182
)
@@ -234,7 +238,7 @@ describe('socket scan reach - dry-run tests', async () => {
234238
'should accept --reach-exclude-paths with comma-separated values',
235239
async cmd => {
236240
const { code, stdout } = await spawnSocketCli(binCliPath, cmd)
237-
expect(stdout).toMatchInlineSnapshot(`"[DryRun]: Bailing now"`)
241+
expect(stdout).toMatchInlineSnapshot(`""`)
238242
expect(code, 'should exit with code 0').toBe(0)
239243
},
240244
)
@@ -256,7 +260,7 @@ describe('socket scan reach - dry-run tests', async () => {
256260
'should accept multiple --reach-exclude-paths flags',
257261
async cmd => {
258262
const { code, stdout } = await spawnSocketCli(binCliPath, cmd)
259-
expect(stdout).toMatchInlineSnapshot(`"[DryRun]: Bailing now"`)
263+
expect(stdout).toMatchInlineSnapshot(`""`)
260264
expect(code, 'should exit with code 0').toBe(0)
261265
},
262266
)
@@ -283,7 +287,7 @@ describe('socket scan reach - dry-run tests', async () => {
283287
'should accept all reachability flags together',
284288
async cmd => {
285289
const { code, stdout } = await spawnSocketCli(binCliPath, cmd)
286-
expect(stdout).toMatchInlineSnapshot(`"[DryRun]: Bailing now"`)
290+
expect(stdout).toMatchInlineSnapshot(`""`)
287291
expect(code, 'should exit with code 0').toBe(0)
288292
},
289293
)
@@ -303,7 +307,7 @@ describe('socket scan reach - dry-run tests', async () => {
303307
'should accept minimal positive memory limit',
304308
async cmd => {
305309
const { code, stdout } = await spawnSocketCli(binCliPath, cmd)
306-
expect(stdout).toMatchInlineSnapshot(`"[DryRun]: Bailing now"`)
310+
expect(stdout).toMatchInlineSnapshot(`""`)
307311
expect(code, 'should exit with code 0').toBe(0)
308312
},
309313
)
@@ -323,7 +327,7 @@ describe('socket scan reach - dry-run tests', async () => {
323327
'should handle single ecosystem flag',
324328
async cmd => {
325329
const { code, stdout } = await spawnSocketCli(binCliPath, cmd)
326-
expect(stdout).toMatchInlineSnapshot(`"[DryRun]: Bailing now"`)
330+
expect(stdout).toMatchInlineSnapshot(`""`)
327331
expect(code, 'should exit with code 0').toBe(0)
328332
},
329333
)
@@ -347,7 +351,7 @@ describe('socket scan reach - dry-run tests', async () => {
347351
'should accept many exclude paths flags',
348352
async cmd => {
349353
const { code, stdout } = await spawnSocketCli(binCliPath, cmd)
350-
expect(stdout).toMatchInlineSnapshot(`"[DryRun]: Bailing now"`)
354+
expect(stdout).toMatchInlineSnapshot(`""`)
351355
expect(code, 'should exit with code 0').toBe(0)
352356
},
353357
)
@@ -373,7 +377,7 @@ describe('socket scan reach - dry-run tests', async () => {
373377
'should accept multiple different ecosystems',
374378
async cmd => {
375379
const { code, stdout } = await spawnSocketCli(binCliPath, cmd)
376-
expect(stdout).toMatchInlineSnapshot(`"[DryRun]: Bailing now"`)
380+
expect(stdout).toMatchInlineSnapshot(`""`)
377381
expect(code, 'should exit with code 0').toBe(0)
378382
},
379383
)
@@ -395,7 +399,7 @@ describe('socket scan reach - dry-run tests', async () => {
395399
'should accept custom memory limit and timeout values',
396400
async cmd => {
397401
const { code, stdout } = await spawnSocketCli(binCliPath, cmd)
398-
expect(stdout).toMatchInlineSnapshot(`"[DryRun]: Bailing now"`)
402+
expect(stdout).toMatchInlineSnapshot(`""`)
399403
expect(code, 'should exit with code 0').toBe(0)
400404
},
401405
)
@@ -455,7 +459,13 @@ describe('socket scan reach - dry-run tests', async () => {
455459
'should accept json output flag alone',
456460
async cmd => {
457461
const { code, stdout } = await spawnSocketCli(binCliPath, cmd)
458-
expect(stdout).toMatchInlineSnapshot(`"[DryRun]: Bailing now"`)
462+
expect(stdout).toMatchInlineSnapshot(`
463+
"{
464+
"ok": false,
465+
"message": "Input error",
466+
"data": "Please review the input requirements and try again\\n\\n \\xd7 This command requires an API token for access (try \`socket login\`)"
467+
}"
468+
`)
459469
expect(code, 'should exit with code 0').toBe(0)
460470
},
461471
)
@@ -474,7 +484,7 @@ describe('socket scan reach - dry-run tests', async () => {
474484
'should accept markdown output flag alone',
475485
async cmd => {
476486
const { code, stdout } = await spawnSocketCli(binCliPath, cmd)
477-
expect(stdout).toMatchInlineSnapshot(`"[DryRun]: Bailing now"`)
487+
expect(stdout).toMatchInlineSnapshot(`""`)
478488
expect(code, 'should exit with code 0').toBe(0)
479489
},
480490
)
@@ -501,7 +511,7 @@ describe('socket scan reach - dry-run tests', async () => {
501511
'{"apiToken":"fakeToken"}',
502512
]
503513
const { code, stdout } = await spawnSocketCli(binCliPath, cmd)
504-
expect(stdout).toMatchInlineSnapshot(`"[DryRun]: Bailing now"`)
514+
expect(stdout).toMatchInlineSnapshot(`""`)
505515
expect(code, 'should exit with code 0').toBe(0)
506516
},
507517
)

packages/cli/src/commands/scan/cmd-scan-reach-validation.test.mts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ describe('socket scan reach - validation tests', () => {
2727
'should accept --output flag with .json extension',
2828
async cmd => {
2929
const { code, stdout } = await spawnSocketCli(binCliPath, cmd)
30-
expect(stdout).toMatchInlineSnapshot(`"[DryRun]: Bailing now"`)
30+
expect(stdout).toMatchInlineSnapshot(`""`)
3131
expect(code, 'should exit with code 0').toBe(0)
3232
},
3333
)
@@ -47,7 +47,7 @@ describe('socket scan reach - validation tests', () => {
4747
'should accept -o short flag with .json extension',
4848
async cmd => {
4949
const { code, stdout } = await spawnSocketCli(binCliPath, cmd)
50-
expect(stdout).toMatchInlineSnapshot(`"[DryRun]: Bailing now"`)
50+
expect(stdout).toMatchInlineSnapshot(`""`)
5151
expect(code, 'should exit with code 0').toBe(0)
5252
},
5353
)
@@ -67,7 +67,7 @@ describe('socket scan reach - validation tests', () => {
6767
'should accept --output flag with path',
6868
async cmd => {
6969
const { code, stdout } = await spawnSocketCli(binCliPath, cmd)
70-
expect(stdout).toMatchInlineSnapshot(`"[DryRun]: Bailing now"`)
70+
expect(stdout).toMatchInlineSnapshot(`""`)
7171
expect(code, 'should exit with code 0').toBe(0)
7272
},
7373
)

0 commit comments

Comments
 (0)