Skip to content

Commit 45319ec

Browse files
committed
woo!
1 parent e588f8b commit 45319ec

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

src/node/cli.ts

-2
Original file line numberDiff line numberDiff line change
@@ -310,12 +310,10 @@ export const parse = (
310310
throw error(`Unknown option ${arg}`)
311311
}
312312

313-
// TODO@jsjoeio add test for this if block
314313
if (key === "password" && !opts?.configFile) {
315314
throw new Error("--password can only be set in the config file or passed in via $PASSWORD")
316315
}
317316

318-
// TODO@jsjoeio add test for this if block
319317
if (key === "hashed-password" && !opts?.configFile) {
320318
throw new Error("--hashed-password can only be set in the config file or passed in via $HASHED_PASSWORD")
321319
}

test/unit/node/cli.test.ts

+12
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,18 @@ describe("parser", () => {
333333
})
334334
})
335335

336+
it("should error if password passed in", () => {
337+
expect(() => parse(["--password", "supersecret123"])).toThrowError(
338+
"--password can only be set in the config file or passed in via $PASSWORD",
339+
)
340+
})
341+
342+
it("should error if hashed-password passed in", () => {
343+
expect(() => parse(["--hashed-password", "fdas423fs8a"])).toThrowError(
344+
"--hashed-password can only be set in the config file or passed in via $HASHED_PASSWORD",
345+
)
346+
})
347+
336348
it("should filter proxy domains", async () => {
337349
const args = parse(["--proxy-domain", "*.coder.com", "--proxy-domain", "coder.com", "--proxy-domain", "coder.org"])
338350
expect(args).toEqual({

0 commit comments

Comments
 (0)