Skip to content

Commit 6ffa2bc

Browse files
authored
Fix ci test (#430)
1 parent aa55dd7 commit 6ffa2bc

File tree

2 files changed

+30
-22
lines changed

2 files changed

+30
-22
lines changed

src/commands/ci/cmd-ci.test.ts

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,40 +7,44 @@ import { cmdit, invokeNpm } from '../../../test/utils'
77

88
const { CLI } = constants
99

10-
describe('socket oops', async () => {
10+
describe('socket ci', async () => {
1111
// Lazily access constants.rootBinPath.
1212
const entryPath = path.join(constants.rootBinPath, `${CLI}.js`)
1313

1414
cmdit(
15-
['oops', '--help', '--config', '{}'],
15+
['ci', '--help', '--config', '{}'],
1616
'should support --help',
1717
async cmd => {
1818
const { code, stderr, stdout } = await invokeNpm(entryPath, cmd)
1919
expect(stdout).toMatchInlineSnapshot(
2020
`
21-
"Trigger an intentional error (for development)
21+
"Create a new scan and report whether it passes your security policy
2222
23-
Usage
24-
$ socket oops oops
23+
Usage
24+
$ socket ci
2525
26-
Don't run me."
27-
`
26+
This command is intended to use in CI runs to allow automated systems to
27+
accept or reject a current build. When the scan does not pass your security
28+
policy, the exit code will be non-zero.
29+
30+
It will use the default org for the set API token."
31+
`
2832
)
2933
expect(`\n ${stderr}`).toMatchInlineSnapshot(`
30-
"
31-
_____ _ _ /---------------
32-
| __|___ ___| |_ ___| |_ | Socket.dev CLI ver <redacted>
33-
|__ | . | _| '_| -_| _| | Node: <redacted>, API token set: <redacted>
34-
|_____|___|___|_,_|___|_|.dev | Command: \`socket oops\`, cwd: <redacted>"
35-
`)
34+
"
35+
_____ _ _ /---------------
36+
| __|___ ___| |_ ___| |_ | Socket.dev CLI ver <redacted>
37+
|__ | . | _| '_| -_| _| | Node: <redacted>, API token set: <redacted>
38+
|_____|___|___|_,_|___|_|.dev | Command: \`socket ci\`, cwd: <redacted>"
39+
`)
3640

3741
expect(code, 'help should exit with code 2').toBe(2)
38-
expect(stderr, 'banner includes base command').toContain('`socket oops`')
42+
expect(stderr, 'banner includes base command').toContain('`socket ci`')
3943
}
4044
)
4145

4246
cmdit(
43-
['oops', '--dry-run', '--config', '{"apiToken":"anything"}'],
47+
['ci', '--dry-run', '--config', '{"apiToken":"anything"}'],
4448
'should require args with just dry-run',
4549
async cmd => {
4650
const { code, stderr, stdout } = await invokeNpm(entryPath, cmd)
@@ -50,7 +54,7 @@ describe('socket oops', async () => {
5054
_____ _ _ /---------------
5155
| __|___ ___| |_ ___| |_ | Socket.dev CLI ver <redacted>
5256
|__ | . | _| '_| -_| _| | Node: <redacted>, API token set: <redacted>
53-
|_____|___|___|_,_|___|_|.dev | Command: \`socket oops\`, cwd: <redacted>"
57+
|_____|___|___|_,_|___|_|.dev | Command: \`socket ci\`, cwd: <redacted>"
5458
`)
5559

5660
expect(code, 'dry-run should exit with code 0 if input ok').toBe(0)

src/commands/scan/generate-report.test.ts

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,16 @@ import type { components } from '@socketsecurity/sdk/types/api'
77

88
describe('generate-report', () => {
99
it('should accept empty args', () => {
10-
const result = generateReport([], {data: {securityPolicyRules: []}}, {
11-
orgSlug: 'fakeorg',
12-
scanId: 'scan-ai-dee',
13-
fold: 'none',
14-
reportLevel: 'warn'
15-
})
10+
const result = generateReport(
11+
[],
12+
{ data: { securityPolicyRules: [] } },
13+
{
14+
orgSlug: 'fakeorg',
15+
scanId: 'scan-ai-dee',
16+
fold: 'none',
17+
reportLevel: 'warn'
18+
}
19+
)
1620

1721
expect(result).toMatchInlineSnapshot(`
1822
{

0 commit comments

Comments
 (0)