Skip to content

Commit 481b30a

Browse files
committed
test: fix breaking unit tests
1 parent d19d0fd commit 481b30a

File tree

2 files changed

+6
-14
lines changed

2 files changed

+6
-14
lines changed

src/commands/flow/scan.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ export default class Scan extends SfCommand<ScanResult> {
4848
description: messages.getMessage("directoryToScan"),
4949
required: false,
5050
exists: true,
51+
exclusive: ["files"],
5152
}),
5253
config: Flags.file({
5354
char: "c",
@@ -71,6 +72,7 @@ export default class Scan extends SfCommand<ScanResult> {
7172
exists: true,
7273
description: "List of source flows paths to scan",
7374
charAliases: ["p"],
75+
exclusive: ["directory"],
7476
}),
7577
targetusername: Flags.string({
7678
char: "u",
@@ -194,12 +196,7 @@ export default class Scan extends SfCommand<ScanResult> {
194196
private findFlows(directory: string, sourcepath: string[]) {
195197
// List flows that will be scanned
196198
let flowFiles;
197-
if (directory && sourcepath) {
198-
this.spinner.stop("Error");
199-
throw new SfError(
200-
"You can only specify one of either directory or sourcepath, not both.",
201-
);
202-
} else if (directory) {
199+
if (directory) {
203200
flowFiles = FindFlows(directory);
204201
} else if (sourcepath) {
205202
flowFiles = sourcepath;

test/commands/flow/scan.test.ts

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,13 @@ describe("flow:scan", () => {
1818
let output: ScanResult;
1919
try {
2020
const output = await new Scan(
21-
[
22-
"--directory",
23-
"test/",
24-
"--sourcepath",
25-
"test/commands/flow/scan.test.ts",
26-
],
21+
["--directory", "test/", "--files", "test/commands/flow/scan.test.ts"],
2722
config,
2823
).run();
2924
console.log(output);
3025
} catch (e) {
31-
expect((e as Error).message).to.include(
32-
"You can only specify one of either directory or sourcepath, not both.",
26+
expect((e as Error).message).to.contains(
27+
"cannot also be provided when using --directory",
3328
);
3429
}
3530
expect(output).to.be.equal(undefined);

0 commit comments

Comments
 (0)