From d77c51694e26067020802402d3a99af1bb95d366 Mon Sep 17 00:00:00 2001 From: Luke Kuzmish Date: Mon, 30 Dec 2024 12:55:00 -0500 Subject: [PATCH] 3 line test --- cli/prompt_secret_test.ts | 32 +++++++++++++++++++++++++------- 1 file changed, 25 insertions(+), 7 deletions(-) diff --git a/cli/prompt_secret_test.ts b/cli/prompt_secret_test.ts index 92b6bf6ae9fb..ba362aafcc67 100644 --- a/cli/prompt_secret_test.ts +++ b/cli/prompt_secret_test.ts @@ -561,19 +561,31 @@ Deno.test("promptSecret() wraps characters wider than console columns", () => { stub(Deno.stdin, "setRaw"); stub(Deno.stdin, "isTerminal", () => true); stub(Deno, "consoleSize", () => { - return { columns: 32, rows: 20 }; + return { columns: 5, rows: 20 }; }); const expectedOutput = [ - "Please provide the password: ", + "? ", "\r\x1b[K", - "Please provide the password: *", + "? *", "\r\x1b[K", - "Please provide the password: **", + "? **", "\r\x1b[K", - "Please provide the password: ***", + "? ***", + "\r\x1b[K", + "*", + "\r\x1b[K", + "**", + "\r\x1b[K", + "***", + "\r\x1b[K", + "****", + "\r\x1b[K", + "*****", "\r\x1b[K", "*", + "\r\x1b[K", + "**", "\n", ]; @@ -596,6 +608,12 @@ Deno.test("promptSecret() wraps characters wider than console columns", () => { "e", "n", "o", + " ", + "r", + "u", + "l", + "e", + "s", "\r", ]; @@ -610,9 +628,9 @@ Deno.test("promptSecret() wraps characters wider than console columns", () => { }, ); - const password = promptSecret("Please provide the password:"); + const password = promptSecret("?"); - assertEquals(password, "deno"); + assertEquals(password, "deno rules"); assertEquals(expectedOutput, actualOutput); restore(); });