diff --git a/frontend/local-client-cli/src/args.test.ts b/frontend/local-client-cli/src/args.test.ts index c075d193..fdf0b6c8 100644 --- a/frontend/local-client-cli/src/args.test.ts +++ b/frontend/local-client-cli/src/args.test.ts @@ -150,25 +150,6 @@ test("parseArgs - default log level is INFO", () => { assert.equal(args.logLevel, LogLevel.INFO); }); -test("parseArgs - parse DEBUG log level", () => { - const args = parseArgs([ - "node", - "cli.js", - "-l", - "/path/to/vault", - "-r", - "https://sync.example.com", - "-t", - "mytoken", - "-v", - "default", - "--log-level", - "DEBUG" - ]); - - assert.equal(args.logLevel, LogLevel.DEBUG); -}); - test("parseArgs - parse ERROR log level", () => { const args = parseArgs([ "node", @@ -188,43 +169,6 @@ test("parseArgs - parse ERROR log level", () => { assert.equal(args.logLevel, LogLevel.ERROR); }); -test("parseArgs - log level is case insensitive", () => { - const args = parseArgs([ - "node", - "cli.js", - "-l", - "/path/to/vault", - "-r", - "https://sync.example.com", - "-t", - "mytoken", - "-v", - "default", - "--log-level", - "debug" - ]); - - assert.equal(args.logLevel, LogLevel.DEBUG); -}); - -test("parseArgs - throws on invalid log level", () => { - assert.throws(() => { - parseArgs([ - "node", - "cli.js", - "-l", - "/path/to/vault", - "-r", - "https://sync.example.com", - "-t", - "mytoken", - "-v", - "default", - "--log-level", - "INVALID" - ]); - }, /Invalid log level/); -}); test("parseArgs - reads required options from environment variables", () => { process.env.VAULTLINK_LOCAL_PATH = "/env/path"; @@ -267,184 +211,3 @@ test("parseArgs - CLI arguments take precedence over environment variables", () delete process.env.VAULTLINK_TOKEN; } }); - -test("parseArgs - reads log level from environment variable", () => { - process.env.VAULTLINK_LOG_LEVEL = "DEBUG"; - - try { - const args = parseArgs([ - "node", - "cli.js", - "-l", - "/path/to/vault", - "-r", - "https://sync.example.com", - "-t", - "mytoken", - "-v", - "default" - ]); - assert.equal(args.logLevel, LogLevel.DEBUG); - } finally { - delete process.env.VAULTLINK_LOG_LEVEL; - } -}); - -test("parseArgs - quiet defaults to false", () => { - const args = parseArgs([ - "node", - "cli.js", - "-l", - "/path/to/vault", - "-r", - "https://sync.example.com", - "-t", - "mytoken", - "-v", - "default" - ]); - - assert.equal(args.quiet, false); -}); - -test("parseArgs - parse --quiet flag", () => { - const args = parseArgs([ - "node", - "cli.js", - "-l", - "/path/to/vault", - "-r", - "https://sync.example.com", - "-t", - "mytoken", - "-v", - "default", - "--quiet" - ]); - - assert.equal(args.quiet, true); -}); - -test("parseArgs - parse -q short flag", () => { - const args = parseArgs([ - "node", - "cli.js", - "-l", - "/path/to/vault", - "-r", - "https://sync.example.com", - "-t", - "mytoken", - "-v", - "default", - "-q" - ]); - - assert.equal(args.quiet, true); -}); - -test("parseArgs - line-endings defaults to auto", () => { - const args = parseArgs([ - "node", - "cli.js", - "-l", - "/path/to/vault", - "-r", - "https://sync.example.com", - "-t", - "mytoken", - "-v", - "default" - ]); - - assert.equal(args.lineEndings, "auto"); -}); - -test("parseArgs - parse --line-endings lf", () => { - const args = parseArgs([ - "node", - "cli.js", - "-l", - "/path/to/vault", - "-r", - "https://sync.example.com", - "-t", - "mytoken", - "-v", - "default", - "--line-endings", - "lf" - ]); - - assert.equal(args.lineEndings, "lf"); -}); - -test("parseArgs - parse --line-endings crlf", () => { - const args = parseArgs([ - "node", - "cli.js", - "-l", - "/path/to/vault", - "-r", - "https://sync.example.com", - "-t", - "mytoken", - "-v", - "default", - "--line-endings", - "crlf" - ]); - - assert.equal(args.lineEndings, "crlf"); -}); - -test("parseArgs - throws on invalid remote URI protocol", () => { - assert.throws(() => { - parseArgs([ - "node", - "cli.js", - "-l", - "/path/to/vault", - "-r", - "ftp://sync.example.com", - "-t", - "mytoken", - "-v", - "default" - ]); - }, /Invalid remote URI/); -}); - -test("parseArgs - accepts http:// remote URI", () => { - const args = parseArgs([ - "node", - "cli.js", - "-l", - "/path/to/vault", - "-r", - "http://localhost:3000", - "-t", - "mytoken", - "-v", - "default" - ]); - - assert.equal(args.remoteUri, "http://localhost:3000"); -}); - -test("parseArgs - accepts wss:// remote URI", () => { - const args = parseArgs([ - "node", - "cli.js", - "-l", - "/path/to/vault", - "-r", - "wss://sync.example.com", - "-t", - "mytoken", - "-v", - "default" - ]); - - assert.equal(args.remoteUri, "wss://sync.example.com"); -});