diff --git a/src/commands/ci/cmd-ci.test.ts b/src/commands/ci/cmd-ci.test.ts index b9b5a78af..989b54bde 100644 --- a/src/commands/ci/cmd-ci.test.ts +++ b/src/commands/ci/cmd-ci.test.ts @@ -7,40 +7,44 @@ import { cmdit, invokeNpm } from '../../../test/utils' const { CLI } = constants -describe('socket oops', async () => { +describe('socket ci', async () => { // Lazily access constants.rootBinPath. const entryPath = path.join(constants.rootBinPath, `${CLI}.js`) cmdit( - ['oops', '--help', '--config', '{}'], + ['ci', '--help', '--config', '{}'], 'should support --help', async cmd => { const { code, stderr, stdout } = await invokeNpm(entryPath, cmd) expect(stdout).toMatchInlineSnapshot( ` - "Trigger an intentional error (for development) + "Create a new scan and report whether it passes your security policy - Usage - $ socket oops oops + Usage + $ socket ci - Don't run me." - ` + This command is intended to use in CI runs to allow automated systems to + accept or reject a current build. When the scan does not pass your security + policy, the exit code will be non-zero. + + It will use the default org for the set API token." + ` ) expect(`\n ${stderr}`).toMatchInlineSnapshot(` - " - _____ _ _ /--------------- - | __|___ ___| |_ ___| |_ | Socket.dev CLI ver - |__ | . | _| '_| -_| _| | Node: , API token set: - |_____|___|___|_,_|___|_|.dev | Command: \`socket oops\`, cwd: " - `) + " + _____ _ _ /--------------- + | __|___ ___| |_ ___| |_ | Socket.dev CLI ver + |__ | . | _| '_| -_| _| | Node: , API token set: + |_____|___|___|_,_|___|_|.dev | Command: \`socket ci\`, cwd: " + `) expect(code, 'help should exit with code 2').toBe(2) - expect(stderr, 'banner includes base command').toContain('`socket oops`') + expect(stderr, 'banner includes base command').toContain('`socket ci`') } ) cmdit( - ['oops', '--dry-run', '--config', '{"apiToken":"anything"}'], + ['ci', '--dry-run', '--config', '{"apiToken":"anything"}'], 'should require args with just dry-run', async cmd => { const { code, stderr, stdout } = await invokeNpm(entryPath, cmd) @@ -50,7 +54,7 @@ describe('socket oops', async () => { _____ _ _ /--------------- | __|___ ___| |_ ___| |_ | Socket.dev CLI ver |__ | . | _| '_| -_| _| | Node: , API token set: - |_____|___|___|_,_|___|_|.dev | Command: \`socket oops\`, cwd: " + |_____|___|___|_,_|___|_|.dev | Command: \`socket ci\`, cwd: " `) expect(code, 'dry-run should exit with code 0 if input ok').toBe(0) diff --git a/src/commands/scan/generate-report.test.ts b/src/commands/scan/generate-report.test.ts index 835468617..4b3d1eb0c 100644 --- a/src/commands/scan/generate-report.test.ts +++ b/src/commands/scan/generate-report.test.ts @@ -7,12 +7,16 @@ import type { components } from '@socketsecurity/sdk/types/api' describe('generate-report', () => { it('should accept empty args', () => { - const result = generateReport([], {data: {securityPolicyRules: []}}, { - orgSlug: 'fakeorg', - scanId: 'scan-ai-dee', - fold: 'none', - reportLevel: 'warn' - }) + const result = generateReport( + [], + { data: { securityPolicyRules: [] } }, + { + orgSlug: 'fakeorg', + scanId: 'scan-ai-dee', + fold: 'none', + reportLevel: 'warn' + } + ) expect(result).toMatchInlineSnapshot(` {