Skip to content

Commit 4b10056

Browse files
Copilotpviti
andauthored
fix: fix config command tests to exercise their respective commands
Agent-Logs-Url: https://github.com/commercelayer/commercelayer-cli/sessions/e4323b0d-fdde-401f-b446-b469a24a0f08 Co-authored-by: pviti <57948342+pviti@users.noreply.github.com>
1 parent 84b8b4c commit 4b10056

5 files changed

Lines changed: 14 additions & 14 deletions

File tree

test/commands/config/del.test.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@ import { runCommand } from '@oclif/test'
22
import { expect } from 'chai'
33

44
describe('config:del', () => {
5-
it('runs noc', async () => {
6-
const { stdout } = await runCommand(['noc'])
7-
expect(stdout).to.contain('-= NoC =-')
5+
it('runs config:del', async () => {
6+
const { error } = await runCommand(['config:del', 'fake'])
7+
expect(error).to.exist
8+
expect(error!.message).to.match(/Invalid configuration param/)
89
})
910
})

test/commands/config/get.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ import { runCommand } from '@oclif/test'
22
import { expect } from 'chai'
33

44
describe('config:get', () => {
5-
it('runs noc', async () => {
6-
const { stdout } = await runCommand(['noc'])
7-
expect(stdout).to.contain('-= NoC =-')
5+
it('runs config:get', async () => {
6+
const { stdout } = await runCommand(['config:get', 'currentApplication'])
7+
expect(stdout).to.contain('currentApplication =')
88
})
99
})

test/commands/config/set.test.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
import { runCommand } from '@oclif/test'
2+
import { expect } from 'chai'
23

34
describe('config:set', () => {
45
it('runs config:set', async () => {
56
const { error } = await runCommand(['config:set', 'fake', 'value'])
6-
7-
if (error && !/Invalid configuration param/.test(error.message)) {
8-
throw error
9-
}
7+
expect(error).to.exist
8+
expect(error!.message).to.match(/Invalid configuration param/)
109
})
1110
})

test/commands/config/show.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ import { runCommand } from '@oclif/test'
22
import { expect } from 'chai'
33

44
describe('config:show', () => {
5-
it('runs noc', async () => {
6-
const { stdout } = await runCommand(['noc'])
7-
expect(stdout).to.contain('-= NoC =-')
5+
it('runs config:show', async () => {
6+
const { stdout, stderr } = await runCommand(['config:show'])
7+
expect(stdout + stderr).to.contain('CLI configuration')
88
})
99
})

tsconfig.tsbuildinfo

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"root":["./src/base.ts","./src/common.ts","./src/config.ts","./src/help.ts","./src/index.ts","./src/commands/noc.ts","./src/commands/applications/add.ts","./src/commands/applications/current.ts","./src/commands/applications/index.ts","./src/commands/applications/info.ts","./src/commands/applications/login.ts","./src/commands/applications/logout.ts","./src/commands/applications/provisioning.ts","./src/commands/applications/scope.ts","./src/commands/applications/switch.ts","./src/commands/applications/token.ts","./src/commands/cli/dir.ts","./src/commands/cli/fig.ts","./src/commands/cli/update.ts","./src/commands/cli/version.ts","./src/commands/config/default.ts","./src/commands/config/del.ts","./src/commands/config/get.ts","./src/commands/config/set.ts","./src/commands/config/show.ts","./src/commands/plugins/available.ts","./src/commands/plugins/latest.ts","./src/hooks/init/update.ts","./src/hooks/postrun/autocomplete.ts","./src/hooks/postrun/plugins_update.ts","./src/hooks/postrun/save.ts","./src/hooks/prerun/application.ts","./src/hooks/prerun/login.ts","./src/hooks/prerun/plugin.ts","./src/patches/command.ts","./src/patches/oclif/execute.ts","./src/typings/fig.d.ts","./src/typings/update-notifier-cjs.d.ts"],"version":"6.0.2"}
1+
{"root":["./src/base.ts","./src/common.ts","./src/config.ts","./src/help.ts","./src/index.ts","./src/commands/noc.ts","./src/commands/applications/add.ts","./src/commands/applications/current.ts","./src/commands/applications/index.ts","./src/commands/applications/info.ts","./src/commands/applications/login.ts","./src/commands/applications/logout.ts","./src/commands/applications/provisioning.ts","./src/commands/applications/scope.ts","./src/commands/applications/switch.ts","./src/commands/applications/token.ts","./src/commands/cli/dir.ts","./src/commands/cli/fig.ts","./src/commands/cli/update.ts","./src/commands/cli/version.ts","./src/commands/config/default.ts","./src/commands/config/del.ts","./src/commands/config/get.ts","./src/commands/config/set.ts","./src/commands/config/show.ts","./src/commands/plugins/available.ts","./src/commands/plugins/latest.ts","./src/hooks/init/update.ts","./src/hooks/postrun/autocomplete.ts","./src/hooks/postrun/plugins_update.ts","./src/hooks/postrun/save.ts","./src/hooks/prerun/application.ts","./src/hooks/prerun/login.ts","./src/hooks/prerun/plugin.ts","./src/patches/command.ts","./src/patches/oclif/execute.ts","./src/typings/fig.d.ts","./src/typings/update-notifier-cjs.d.ts"],"errors":true,"version":"6.0.2"}

0 commit comments

Comments
 (0)