Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
update snapshots
  • Loading branch information
c4spar committed Apr 3, 2023
commit b25968f8a12d3eb823a3241202295eafa1843407
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export const snapshot = {};

snapshot[`prompt snapshot tests file:///Users/c4spar/workspace/deno/deno-cliffy/prompt/test/integration/checkbox_test.ts 1`] = `
snapshot[`assert prompt snapshot - checkbox_test.ts 1`] = `
"stdout:
? Select an option
❯ ✘ Foo
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export const snapshot = {};

snapshot[`prompt snapshot tests file:///Users/c4spar/workspace/deno/deno-cliffy/prompt/test/integration/checkbox_test.ts 1`] = `
snapshot[`assert prompt snapshot - checkbox_test.ts 1`] = `
"stdout:
? Select an option
❯ × Foo
Expand Down
6 changes: 3 additions & 3 deletions prompt/test/integration/__snapshots__/confirm_test.ts.snap
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export const snapshot = {};

snapshot[`prompt snapshot tests file:///Users/c4spar/workspace/deno/deno-cliffy/prompt/test/integration/confirm_test.ts 1`] = `
snapshot[`assert prompt snapshot - confirm_test.ts 1`] = `
"stdout:
? Please confirm (y/N) ›
❯ some hint\\x1b[1A\\x1b[26G\\x1b[G\\x1b[0J
Expand All @@ -12,7 +12,7 @@ stderr:
"
`;

snapshot[`prompt snapshot tests file:///Users/c4spar/workspace/deno/deno-cliffy/prompt/test/integration/confirm_test.ts 2`] = `
snapshot[`assert prompt snapshot - confirm_test.ts 2`] = `
"stdout:
? Please confirm (y/N) ›
❯ some hint\\x1b[1A\\x1b[26G\\x1b[G\\x1b[0J
Expand All @@ -24,7 +24,7 @@ stderr:
"
`;

snapshot[`prompt snapshot tests file:///Users/c4spar/workspace/deno/deno-cliffy/prompt/test/integration/confirm_test.ts 3`] = `
snapshot[`assert prompt snapshot - confirm_test.ts 3`] = `
"stdout:
? Please confirm (y/N) ›
❯ some hint\\x1b[1A\\x1b[26G\\x1b[G\\x1b[0J
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export const snapshot = {};

snapshot[`prompt snapshot tests file:///Users/c4spar/workspace/deno/deno-cliffy/prompt/test/integration/confirm_test.ts 1`] = `
snapshot[`assert prompt snapshot - confirm_test.ts 1`] = `
"stdout:
? Please confirm (y/N) »
❯ some hint\\x1b[1A\\x1b[26G\\x1b[G\\x1b[0J
Expand All @@ -12,7 +12,7 @@ stderr:
"
`;

snapshot[`prompt snapshot tests file:///Users/c4spar/workspace/deno/deno-cliffy/prompt/test/integration/confirm_test.ts 2`] = `
snapshot[`assert prompt snapshot - confirm_test.ts 2`] = `
"stdout:
? Please confirm (y/N) »
❯ some hint\\x1b[1A\\x1b[26G\\x1b[G\\x1b[0J
Expand All @@ -24,7 +24,7 @@ stderr:
"
`;

snapshot[`prompt snapshot tests file:///Users/c4spar/workspace/deno/deno-cliffy/prompt/test/integration/confirm_test.ts 3`] = `
snapshot[`assert prompt snapshot - confirm_test.ts 3`] = `
"stdout:
? Please confirm (y/N) »
❯ some hint\\x1b[1A\\x1b[26G\\x1b[G\\x1b[0J
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export const snapshot = {};

snapshot[`prompt snapshot tests file:///Users/c4spar/workspace/deno/deno-cliffy/prompt/test/integration/input_no_location_flag_test.ts 1`] = `
snapshot[`assert prompt snapshot - input_no_location_flag_test.ts 1`] = `
"stdout:
? Works without --location? (hope so) › \\x1b[41G\\x1b[G\\x1b[0J
? Works without --location? (hope so) › yes\\x1b[44G\\x1b[G\\x1b[0J
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export const snapshot = {};

snapshot[`prompt snapshot tests file:///Users/c4spar/workspace/deno/deno-cliffy/prompt/test/integration/input_no_location_flag_test.ts 1`] = `
snapshot[`assert prompt snapshot - input_no_location_flag_test.ts 1`] = `
"stdout:
? Works without --location? (hope so) » \\x1b[41G\\x1b[G\\x1b[0J
? Works without --location? (hope so) » yes\\x1b[44G\\x1b[G\\x1b[0J
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export const snapshot = {};

snapshot[`prompt snapshot tests file:///Users/c4spar/workspace/deno/deno-cliffy/prompt/test/integration/input_no_prefix_test.ts 1`] = `
snapshot[`assert prompt snapshot - input_no_prefix_test.ts 1`] = `
"stdout:
Whats your name? (foo) › \\x1b[26G\\x1b[G\\x1b[0J
Whats your name? (foo) › bar\\x1b[29G\\x1b[G\\x1b[0J
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export const snapshot = {};

snapshot[`prompt snapshot tests file:///Users/c4spar/workspace/deno/deno-cliffy/prompt/test/integration/input_no_prefix_test.ts 1`] = `
snapshot[`assert prompt snapshot - input_no_prefix_test.ts 1`] = `
"stdout:
Whats your name? (foo) » \\x1b[26G\\x1b[G\\x1b[0J
Whats your name? (foo) » bar\\x1b[29G\\x1b[G\\x1b[0J
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export const snapshot = {};

snapshot[`prompt snapshot tests file:///Users/c4spar/workspace/deno/deno-cliffy/prompt/test/integration/input_output_stream_test.ts 1`] = `
snapshot[`assert prompt snapshot - input_output_stream_test.ts 1`] = `
"stdout:

stderr:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export const snapshot = {};

snapshot[`prompt snapshot tests file:///Users/c4spar/workspace/deno/deno-cliffy/prompt/test/integration/input_output_stream_test.ts 1`] = `
snapshot[`assert prompt snapshot - input_output_stream_test.ts 1`] = `
"stdout:

stderr:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export const snapshot = {};

snapshot[`prompt snapshot tests file:///Users/c4spar/workspace/deno/deno-cliffy/prompt/test/integration/input_prefix_test.ts 1`] = `
snapshot[`assert prompt snapshot - input_prefix_test.ts 1`] = `
"stdout:
PREFIX Whats your name? (foo) › \\x1b[33G\\x1b[G\\x1b[0J
PREFIX Whats your name? (foo) › bar\\x1b[36G\\x1b[G\\x1b[0J
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export const snapshot = {};

snapshot[`prompt snapshot tests file:///Users/c4spar/workspace/deno/deno-cliffy/prompt/test/integration/input_prefix_test.ts 1`] = `
snapshot[`assert prompt snapshot - input_prefix_test.ts 1`] = `
"stdout:
PREFIX Whats your name? (foo) » \\x1b[33G\\x1b[G\\x1b[0J
PREFIX Whats your name? (foo) » bar\\x1b[36G\\x1b[G\\x1b[0J
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export const snapshot = {};

snapshot[`prompt snapshot tests file:///Users/c4spar/workspace/deno/deno-cliffy/prompt/test/integration/input_suggestions_test.ts 1`] = `
snapshot[`assert prompt snapshot - input_suggestions_test.ts 1`] = `
"stdout:
? Whats your name? (foo) ›
foo
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export const snapshot = {};

snapshot[`prompt snapshot tests file:///Users/c4spar/workspace/deno/deno-cliffy/prompt/test/integration/input_suggestions_test.ts 1`] = `
snapshot[`assert prompt snapshot - input_suggestions_test.ts 1`] = `
"stdout:
? Whats your name? (foo) »
foo
Expand Down
2 changes: 1 addition & 1 deletion prompt/test/integration/__snapshots__/input_test.ts.snap
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export const snapshot = {};

snapshot[`prompt snapshot tests file:///Users/c4spar/workspace/deno/deno-cliffy/prompt/test/integration/input_test.ts 1`] = `
snapshot[`assert prompt snapshot - input_test.ts 1`] = `
"stdout:
? Whats your name? (foo) › \\x1b[28G\\x1b[G\\x1b[0J
? Whats your name? (foo) › foo bar\\x1b[35G\\x1b[G\\x1b[0J
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export const snapshot = {};

snapshot[`prompt snapshot tests file:///Users/c4spar/workspace/deno/deno-cliffy/prompt/test/integration/input_test.ts 1`] = `
snapshot[`assert prompt snapshot - input_test.ts 1`] = `
"stdout:
? Whats your name? (foo) » \\x1b[28G\\x1b[G\\x1b[0J
? Whats your name? (foo) » foo bar\\x1b[35G\\x1b[G\\x1b[0J
Expand Down
2 changes: 1 addition & 1 deletion prompt/test/integration/__snapshots__/list_test.ts.snap
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export const snapshot = {};

snapshot[`prompt snapshot tests file:///Users/c4spar/workspace/deno/deno-cliffy/prompt/test/integration/list_test.ts 1`] = `
snapshot[`assert prompt snapshot - list_test.ts 1`] = `
"stdout:
? Enter some keywords (foo, far) ›
❯ some hint...\\x1b[1A\\x1b[36G\\x1b[G\\x1b[0J
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export const snapshot = {};

snapshot[`prompt snapshot tests file:///Users/c4spar/workspace/deno/deno-cliffy/prompt/test/integration/list_test.ts 1`] = `
snapshot[`assert prompt snapshot - list_test.ts 1`] = `
"stdout:
? Enter some keywords (foo, far) »
❯ some hint...\\x1b[1A\\x1b[36G\\x1b[G\\x1b[0J
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export const snapshot = {};

snapshot[`prompt snapshot tests file:///Users/c4spar/workspace/deno/deno-cliffy/prompt/test/integration/number_decimal_test.ts 1`] = `
snapshot[`assert prompt snapshot - number_decimal_test.ts 1`] = `
"stdout:
? How old are you? (7) › \\x1b[26G\\x1b[G\\x1b[0J
? How old are you? (7) › 19.\\x1b[29G\\x1b[G\\x1b[0J
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export const snapshot = {};

snapshot[`prompt snapshot tests file:///Users/c4spar/workspace/deno/deno-cliffy/prompt/test/integration/number_decimal_test.ts 1`] = `
snapshot[`assert prompt snapshot - number_decimal_test.ts 1`] = `
"stdout:
? How old are you? (7) » \\x1b[26G\\x1b[G\\x1b[0J
? How old are you? (7) » 19.\\x1b[29G\\x1b[G\\x1b[0J
Expand Down
2 changes: 1 addition & 1 deletion prompt/test/integration/__snapshots__/number_test.ts.snap
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export const snapshot = {};

snapshot[`prompt snapshot tests file:///Users/c4spar/workspace/deno/deno-cliffy/prompt/test/integration/number_test.ts 1`] = `
snapshot[`assert prompt snapshot - number_test.ts 1`] = `
"stdout:
? How old are you? (7) › \\x1b[26G\\x1b[G\\x1b[0J
? How old are you? (7) › 19\\x1b[28G\\x1b[G\\x1b[0J
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export const snapshot = {};

snapshot[`prompt snapshot tests file:///Users/c4spar/workspace/deno/deno-cliffy/prompt/test/integration/number_test.ts 1`] = `
snapshot[`assert prompt snapshot - number_test.ts 1`] = `
"stdout:
? How old are you? (7) » \\x1b[26G\\x1b[G\\x1b[0J
? How old are you? (7) » 19\\x1b[28G\\x1b[G\\x1b[0J
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export const snapshot = {};

snapshot[`prompt snapshot tests file:///Users/c4spar/workspace/deno/deno-cliffy/prompt/test/integration/prompt_list_test.ts 1`] = `
snapshot[`assert prompt snapshot - prompt_list_test.ts 1`] = `
'stdout:
[checkbox:before] input is: foo
{ input: "foo", number: 43, confirm: true, toggle: true, checkbox: [ "bar", "baz" ] }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export const snapshot = {};

snapshot[`prompt snapshot tests file:///Users/c4spar/workspace/deno/deno-cliffy/prompt/test/integration/prompt_list_test.ts 1`] = `
snapshot[`assert prompt snapshot - prompt_list_test.ts 1`] = `
'stdout:
[checkbox:before] input is: foo
{ input: "foo", number: 43, confirm: true, toggle: true, checkbox: [ "bar", "baz" ] }
Expand Down
2 changes: 1 addition & 1 deletion prompt/test/integration/__snapshots__/secret_test.ts.snap
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export const snapshot = {};

snapshot[`prompt snapshot tests file:///Users/c4spar/workspace/deno/deno-cliffy/prompt/test/integration/secret_test.ts 1`] = `
snapshot[`assert prompt snapshot - secret_test.ts 1`] = `
"stdout:
? enter your secret › \\x1b[23G\\x1b[G\\x1b[0J
? enter your secret › ***\\x1b[26G\\x1b[G\\x1b[0J
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export const snapshot = {};

snapshot[`prompt snapshot tests file:///Users/c4spar/workspace/deno/deno-cliffy/prompt/test/integration/secret_test.ts 1`] = `
snapshot[`assert prompt snapshot - secret_test.ts 1`] = `
"stdout:
? enter your secret » \\x1b[23G\\x1b[G\\x1b[0J
? enter your secret » ***\\x1b[26G\\x1b[G\\x1b[0J
Expand Down
2 changes: 1 addition & 1 deletion prompt/test/integration/__snapshots__/select_test.ts.snap
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export const snapshot = {};

snapshot[`prompt snapshot tests file:///Users/c4spar/workspace/deno/deno-cliffy/prompt/test/integration/select_test.ts 1`] = `
snapshot[`assert prompt snapshot - select_test.ts 1`] = `
"stdout:
? Select an option
❯ Foo
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export const snapshot = {};

snapshot[`prompt snapshot tests file:///Users/c4spar/workspace/deno/deno-cliffy/prompt/test/integration/select_test.ts 1`] = `
snapshot[`assert prompt snapshot - select_test.ts 1`] = `
"stdout:
? Select an option
❯ Foo
Expand Down
2 changes: 1 addition & 1 deletion prompt/test/integration/__snapshots__/toggle_test.ts.snap
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export const snapshot = {};

snapshot[`prompt snapshot tests file:///Users/c4spar/workspace/deno/deno-cliffy/prompt/test/integration/toggle_test.ts 1`] = `
snapshot[`assert prompt snapshot - toggle_test.ts 1`] = `
"stdout:
? Please confirm (No) › No / Yes
❯ some hint\\x1b[1A\\x1b[0G\\x1b[?25l\\x1b[G\\x1b[0J
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export const snapshot = {};

snapshot[`prompt snapshot tests file:///Users/c4spar/workspace/deno/deno-cliffy/prompt/test/integration/toggle_test.ts 1`] = `
snapshot[`assert prompt snapshot - toggle_test.ts 1`] = `
"stdout:
? Please confirm (No) » No / Yes
❯ some hint\\x1b[1A\\x1b[0G\\x1b[?25l\\x1b[G\\x1b[0J
Expand Down
6 changes: 4 additions & 2 deletions prompt/testing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,10 @@ export async function assertPromptSnapshot(
}

function registerTest(options: AssertPromptSnapshotOptions) {
const fileName = basename(options.meta.url);

Deno.test({
name: `prompt snapshot tests ${options.meta.url}`,
name: `assert prompt snapshot - ${fileName}`,
async fn(ctx) {
const tests = Object.entries(options.tests ?? {});
if (!tests.length) {
Expand All @@ -88,7 +90,7 @@ function registerTest(options: AssertPromptSnapshotOptions) {
: "";

await assertSnapshot(ctx, output, {
path: `__snapshots__/${basename(options.meta.url)}${suffix}.snap`,
path: `__snapshots__/${fileName}${suffix}.snap`,
});
},
});
Expand Down