Skip to content

Commit 9703c8d

Browse files
committed
test(cli): add test for --api-key option in mon local-install
Verify that when --api-key and --db-url are provided via CLI options, the command uses them directly without prompting for interactive input.
1 parent 19e081d commit 9703c8d

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

cli/test/init.test.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,23 @@ describe("CLI commands", () => {
337337
expect(r.stdout).toMatch(/--api-key/);
338338
});
339339

340+
test("cli: mon local-install --api-key and --db-url skip interactive prompts", () => {
341+
// This test verifies that when --api-key and --db-url are provided,
342+
// the CLI uses them directly without prompting for input.
343+
// The command will fail later (no Docker, invalid DB), but we check
344+
// that the options were parsed and used correctly.
345+
const r = runCli([
346+
"mon", "local-install",
347+
"--api-key", "test-api-key-12345",
348+
"--db-url", "postgresql://user:pass@localhost:5432/testdb"
349+
]);
350+
351+
// Should show that API key was provided via CLI option (not prompting)
352+
expect(r.stdout).toMatch(/Using API key provided via --api-key parameter/);
353+
// Should show that DB URL was provided via CLI option (not prompting)
354+
expect(r.stdout).toMatch(/Using database URL provided via --db-url parameter/);
355+
});
356+
340357
test("cli: auth login --help shows --set-key option", () => {
341358
const r = runCli(["auth", "login", "--help"]);
342359
expect(r.status).toBe(0);

0 commit comments

Comments
 (0)