Skip to content

Commit 5957bb1

Browse files
committed
Add unit tests
1 parent 7110cb5 commit 5957bb1

File tree

6 files changed

+1007
-6
lines changed

6 files changed

+1007
-6
lines changed

src/commands/fix/cmd-fix.mts

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { logger } from '@socketsecurity/registry/lib/logger'
88

99
import { handleFix } from './handle-fix.mts'
1010
import constants from '../../constants.mts'
11-
import { commonFlags } from '../../flags.mts'
11+
import { commonFlags, outputFlags } from '../../flags.mts'
1212
import { checkCommandInput } from '../../utils/check-input.mts'
1313
import { cmdFlagValueToArray } from '../../utils/cmd.mts'
1414
import { getOutputKind } from '../../utils/get-output-kind.mts'
@@ -50,6 +50,7 @@ async function run(
5050
hidden,
5151
flags: {
5252
...commonFlags,
53+
...outputFlags,
5354
autoMerge: {
5455
type: 'boolean',
5556
default: false,
@@ -186,11 +187,20 @@ Available styles:
186187

187188
const outputKind = getOutputKind(cli.flags['json'], cli.flags['markdown'])
188189

189-
const wasValidInput = checkCommandInput(outputKind, {
190-
test: RangeStyles.includes(rangeStyle),
191-
message: `Expecting range style of ${joinOr(RangeStyles)}`,
192-
fail: 'invalid',
193-
})
190+
const wasValidInput = checkCommandInput(
191+
outputKind,
192+
{
193+
test: RangeStyles.includes(rangeStyle),
194+
message: `Expecting range style of ${joinOr(RangeStyles)}`,
195+
fail: 'invalid',
196+
},
197+
{
198+
nook: true,
199+
test: !cli.flags['json'] || !cli.flags['markdown'],
200+
message: 'The json and markdown flags cannot be both set, pick one',
201+
fail: 'omit one',
202+
},
203+
)
194204
if (!wasValidInput) {
195205
return
196206
}

0 commit comments

Comments
 (0)