@shopify/cli-kit 3.35.0 → 3.36.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/content-tokens.js +1 -1
- package/dist/content-tokens.js.map +1 -1
- package/dist/error.js +2 -2
- package/dist/error.js.map +1 -1
- package/dist/index.d.ts +0 -3
- package/dist/index.js +0 -3
- package/dist/index.js.map +1 -1
- package/dist/metadata.d.ts +1 -1
- package/dist/metadata.js.map +1 -1
- package/dist/monorail.d.ts +1 -1
- package/dist/monorail.js +1 -1
- package/dist/monorail.js.map +1 -1
- package/dist/output.js +0 -4
- package/dist/output.js.map +1 -1
- package/dist/plugins.d.ts +1 -1
- package/dist/plugins.js.map +1 -1
- package/dist/{typing → private/common/ts}/deep-required.d.ts +3 -3
- package/dist/{typing → private/common/ts}/deep-required.js +0 -0
- package/dist/private/common/ts/deep-required.js.map +1 -0
- package/dist/{typing → private/common/ts}/overloaded-parameters.d.ts +0 -0
- package/dist/{typing → private/common/ts}/overloaded-parameters.js +0 -0
- package/dist/private/common/ts/overloaded-parameters.js.map +1 -0
- package/dist/private/node/api/graphql.js +1 -2
- package/dist/private/node/api/graphql.js.map +1 -1
- package/dist/private/node/api/headers.d.ts +9 -0
- package/dist/private/node/api/headers.js +26 -0
- package/dist/private/node/api/headers.js.map +1 -1
- package/dist/private/node/constants.js +3 -3
- package/dist/private/node/constants.js.map +1 -1
- package/dist/private/node/session/device-authorization.js +1 -1
- package/dist/private/node/session/device-authorization.js.map +1 -1
- package/dist/private/node/session/exchange.js +1 -1
- package/dist/private/node/session/exchange.js.map +1 -1
- package/dist/private/node/session/identity-token-validation.js +1 -1
- package/dist/private/node/session/identity-token-validation.js.map +1 -1
- package/dist/private/node/session/post-auth.js +3 -3
- package/dist/private/node/session/post-auth.js.map +1 -1
- package/dist/{typing → private/node}/simple-definitions.d.ts +0 -0
- package/dist/{typing → private/node}/simple-definitions.js +0 -0
- package/dist/private/node/simple-definitions.js.map +1 -0
- package/dist/private/node/ui/alert.d.ts +1 -1
- package/dist/private/node/ui/alert.js +2 -2
- package/dist/private/node/ui/alert.js.map +1 -1
- package/dist/private/node/ui/components/Alert.d.ts +5 -0
- package/dist/private/node/ui/components/Alert.js +9 -6
- package/dist/private/node/ui/components/Alert.js.map +1 -1
- package/dist/private/node/ui/components/Alert.test.js +30 -4
- package/dist/private/node/ui/components/Alert.test.js.map +1 -1
- package/dist/private/node/ui/components/AutocompletePrompt.d.ts +12 -0
- package/dist/private/node/ui/components/AutocompletePrompt.js +111 -0
- package/dist/private/node/ui/components/AutocompletePrompt.js.map +1 -0
- package/dist/private/node/ui/components/AutocompletePrompt.test.d.ts +1 -0
- package/dist/private/node/ui/components/AutocompletePrompt.test.js +473 -0
- package/dist/private/node/ui/components/AutocompletePrompt.test.js.map +1 -0
- package/dist/private/node/ui/components/Banner.d.ts +0 -1
- package/dist/private/node/ui/components/Banner.js +4 -4
- package/dist/private/node/ui/components/Banner.js.map +1 -1
- package/dist/private/node/ui/components/Banner.test.js +10 -5
- package/dist/private/node/ui/components/Banner.test.js.map +1 -1
- package/dist/private/node/ui/components/FatalError.js +1 -1
- package/dist/private/node/ui/components/FatalError.js.map +1 -1
- package/dist/private/node/ui/components/FatalError.test.js +4 -8
- package/dist/private/node/ui/components/FatalError.test.js.map +1 -1
- package/dist/private/node/ui/components/{Table.d.ts → Prompts/InfoTable.d.ts} +2 -2
- package/dist/private/node/ui/components/{Table.js → Prompts/InfoTable.js} +6 -6
- package/dist/private/node/ui/components/Prompts/InfoTable.js.map +1 -0
- package/dist/private/node/ui/components/SelectInput.d.ts +9 -2
- package/dist/private/node/ui/components/SelectInput.js +96 -52
- package/dist/private/node/ui/components/SelectInput.js.map +1 -1
- package/dist/private/node/ui/components/SelectInput.test.js +140 -54
- package/dist/private/node/ui/components/SelectInput.test.js.map +1 -1
- package/dist/private/node/ui/components/SelectPrompt.d.ts +4 -3
- package/dist/private/node/ui/components/SelectPrompt.js +17 -11
- package/dist/private/node/ui/components/SelectPrompt.js.map +1 -1
- package/dist/private/node/ui/components/SelectPrompt.test.js +113 -23
- package/dist/private/node/ui/components/SelectPrompt.test.js.map +1 -1
- package/dist/private/node/ui/components/Tasks.d.ts +6 -5
- package/dist/private/node/ui/components/Tasks.js +32 -11
- package/dist/private/node/ui/components/Tasks.js.map +1 -1
- package/dist/private/node/ui/components/Tasks.test.js +55 -9
- package/dist/private/node/ui/components/Tasks.test.js.map +1 -1
- package/dist/private/node/ui/components/TextInput.d.ts +4 -1
- package/dist/private/node/ui/components/TextInput.js +22 -13
- package/dist/private/node/ui/components/TextInput.js.map +1 -1
- package/dist/private/node/ui/components/TextInput.test.js +47 -40
- package/dist/private/node/ui/components/TextInput.test.js.map +1 -1
- package/dist/private/node/ui/components/TextPrompt.d.ts +3 -1
- package/dist/private/node/ui/components/TextPrompt.js +28 -15
- package/dist/private/node/ui/components/TextPrompt.js.map +1 -1
- package/dist/private/node/ui/components/TextPrompt.test.js +71 -15
- package/dist/private/node/ui/components/TextPrompt.test.js.map +1 -1
- package/dist/private/node/ui/components/TokenizedText.d.ts +3 -0
- package/dist/private/node/ui/components/TokenizedText.js +33 -1
- package/dist/private/node/ui/components/TokenizedText.js.map +1 -1
- package/dist/private/node/ui/utilities.d.ts +2 -0
- package/dist/private/node/ui/utilities.js +6 -0
- package/dist/private/node/ui/utilities.js.map +1 -0
- package/dist/{typing → public/common/ts}/pick-by-prefix.d.ts +4 -3
- package/dist/{typing → public/common/ts}/pick-by-prefix.js +0 -0
- package/dist/public/common/ts/pick-by-prefix.js.map +1 -0
- package/dist/public/common/version.d.ts +1 -1
- package/dist/public/common/version.js +1 -1
- package/dist/public/common/version.js.map +1 -1
- package/dist/public/node/api/admin.js +1 -1
- package/dist/public/node/api/admin.js.map +1 -1
- package/dist/public/node/api/http.d.ts +0 -0
- package/dist/public/node/api/http.js +2 -0
- package/dist/public/node/api/http.js.map +1 -0
- package/dist/public/node/api/oxygen.js +1 -1
- package/dist/public/node/api/oxygen.js.map +1 -1
- package/dist/public/node/archiver.js +2 -1
- package/dist/public/node/archiver.js.map +1 -1
- package/dist/public/node/cli.js +2 -2
- package/dist/public/node/cli.js.map +1 -1
- package/dist/public/node/environment/spin.js +2 -2
- package/dist/public/node/environment/spin.js.map +1 -1
- package/dist/public/node/error-handler.js +7 -5
- package/dist/public/node/error-handler.js.map +1 -1
- package/dist/public/node/framework.js +2 -2
- package/dist/public/node/framework.js.map +1 -1
- package/dist/public/node/fs.d.ts +22 -4
- package/dist/public/node/fs.js +34 -6
- package/dist/public/node/fs.js.map +1 -1
- package/dist/public/node/github.js +1 -1
- package/dist/public/node/github.js.map +1 -1
- package/dist/{http/fetch.d.ts → public/node/http.d.ts} +18 -7
- package/dist/{http/fetch.js → public/node/http.js} +22 -9
- package/dist/public/node/http.js.map +1 -0
- package/dist/public/node/liquid.js +4 -4
- package/dist/public/node/liquid.js.map +1 -1
- package/dist/public/node/node-package-manager.d.ts +22 -1
- package/dist/public/node/node-package-manager.js +22 -11
- package/dist/public/node/node-package-manager.js.map +1 -1
- package/dist/public/node/path.d.ts +22 -0
- package/dist/{path.js → public/node/path.js} +8 -20
- package/dist/public/node/path.js.map +1 -0
- package/dist/public/node/presets.js +4 -4
- package/dist/public/node/presets.js.map +1 -1
- package/dist/public/node/ruby.js +23 -27
- package/dist/public/node/ruby.js.map +1 -1
- package/dist/public/node/ui.d.ts +50 -9
- package/dist/public/node/ui.js +69 -8
- package/dist/public/node/ui.js.map +1 -1
- package/dist/public/node/vscode.js +4 -4
- package/dist/public/node/vscode.js.map +1 -1
- package/dist/testing/ui.d.ts +4 -1
- package/dist/testing/ui.js +24 -1
- package/dist/testing/ui.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/ui/executor.d.ts +2 -14
- package/dist/ui/executor.js +38 -72
- package/dist/ui/executor.js.map +1 -1
- package/dist/ui.js +6 -23
- package/dist/ui.js.map +1 -1
- package/package.json +3 -5
- package/dist/http/fetch.js.map +0 -1
- package/dist/http/formdata.d.ts +0 -3
- package/dist/http/formdata.js +0 -6
- package/dist/http/formdata.js.map +0 -1
- package/dist/http.d.ts +0 -26
- package/dist/http.js +0 -31
- package/dist/http.js.map +0 -1
- package/dist/npm.d.ts +0 -27
- package/dist/npm.js +0 -20
- package/dist/npm.js.map +0 -1
- package/dist/path.d.ts +0 -25
- package/dist/path.js.map +0 -1
- package/dist/private/node/ui/components/Table.js.map +0 -1
- package/dist/typing/deep-required.js.map +0 -1
- package/dist/typing/overloaded-parameters.js.map +0 -1
- package/dist/typing/pick-by-prefix.js.map +0 -1
- package/dist/typing/simple-definitions.js.map +0 -1
- package/dist/ui/inquirer/autocomplete.d.ts +0 -11
- package/dist/ui/inquirer/autocomplete.js +0 -110
- package/dist/ui/inquirer/autocomplete.js.map +0 -1
- package/dist/ui/inquirer/input.d.ts +0 -16
- package/dist/ui/inquirer/input.js +0 -45
- package/dist/ui/inquirer/input.js.map +0 -1
- package/dist/ui/inquirer/password.d.ts +0 -7
- package/dist/ui/inquirer/password.js +0 -8
- package/dist/ui/inquirer/password.js.map +0 -1
- package/dist/ui/inquirer/select.d.ts +0 -14
- package/dist/ui/inquirer/select.js +0 -26
- package/dist/ui/inquirer/select.js.map +0 -1
|
@@ -0,0 +1,473 @@
|
|
|
1
|
+
import { AutocompletePrompt } from './AutocompletePrompt.js';
|
|
2
|
+
import { getLastFrameAfterUnmount, sendInputAndWait, sendInputAndWaitForChange, sendInputAndWaitForContent, waitForContent, waitForInputsToBeReady, } from '../../../../testing/ui.js';
|
|
3
|
+
import { describe, expect, test, vi } from 'vitest';
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import { render } from 'ink-testing-library';
|
|
6
|
+
const ARROW_DOWN = '\u001B[B';
|
|
7
|
+
const ENTER = '\r';
|
|
8
|
+
const DELETE = '\u007F';
|
|
9
|
+
const DATABASE = [
|
|
10
|
+
{ label: 'first', value: 'first' },
|
|
11
|
+
{ label: 'second', value: 'second' },
|
|
12
|
+
{ label: 'third', value: 'third' },
|
|
13
|
+
{ label: 'fourth', value: 'fourth' },
|
|
14
|
+
{ label: 'fifth', value: 'fifth' },
|
|
15
|
+
{ label: 'sixth', value: 'sixth' },
|
|
16
|
+
{ label: 'seventh', value: 'seventh' },
|
|
17
|
+
{ label: 'eighth', value: 'eighth' },
|
|
18
|
+
{ label: 'ninth', value: 'ninth' },
|
|
19
|
+
{ label: 'tenth', value: 'tenth' },
|
|
20
|
+
{ label: 'eleventh', value: 'eleventh' },
|
|
21
|
+
{ label: 'twelfth', value: 'twelfth' },
|
|
22
|
+
{ label: 'thirteenth', value: 'thirteenth' },
|
|
23
|
+
{ label: 'fourteenth', value: 'fourteenth' },
|
|
24
|
+
{ label: 'fifteenth', value: 'fifteenth' },
|
|
25
|
+
{ label: 'sixteenth', value: 'sixteenth' },
|
|
26
|
+
{ label: 'seventeenth', value: 'seventeenth' },
|
|
27
|
+
{ label: 'eighteenth', value: 'eighteenth' },
|
|
28
|
+
{ label: 'nineteenth', value: 'nineteenth' },
|
|
29
|
+
{ label: 'twentieth', value: 'twentieth' },
|
|
30
|
+
{ label: 'twenty-first', value: 'twenty-first' },
|
|
31
|
+
{ label: 'twenty-second', value: 'twenty-second' },
|
|
32
|
+
{ label: 'twenty-third', value: 'twenty-third' },
|
|
33
|
+
{ label: 'twenty-fourth', value: 'twenty-fourth' },
|
|
34
|
+
{ label: 'twenty-fifth', value: 'twenty-fifth' },
|
|
35
|
+
{ label: 'twenty-sixth', value: 'twenty-sixth' },
|
|
36
|
+
{ label: 'twenty-seventh', value: 'twenty-seventh' },
|
|
37
|
+
{ label: 'twenty-eighth', value: 'twenty-eighth' },
|
|
38
|
+
{ label: 'twenty-ninth', value: 'twenty-ninth' },
|
|
39
|
+
{ label: 'thirtieth', value: 'thirtieth' },
|
|
40
|
+
{ label: 'thirty-first', value: 'thirty-first' },
|
|
41
|
+
{ label: 'thirty-second', value: 'thirty-second' },
|
|
42
|
+
{ label: 'thirty-third', value: 'thirty-third' },
|
|
43
|
+
{ label: 'thirty-fourth', value: 'thirty-fourth' },
|
|
44
|
+
{ label: 'thirty-fifth', value: 'thirty-fifth' },
|
|
45
|
+
{ label: 'thirty-sixth', value: 'thirty-sixth' },
|
|
46
|
+
{ label: 'thirty-seventh', value: 'thirty-seventh' },
|
|
47
|
+
{ label: 'thirty-eighth', value: 'thirty-eighth' },
|
|
48
|
+
{ label: 'thirty-ninth', value: 'thirty-ninth' },
|
|
49
|
+
{ label: 'fortieth', value: 'fortieth' },
|
|
50
|
+
{ label: 'forty-first', value: 'forty-first' },
|
|
51
|
+
{ label: 'forty-second', value: 'forty-second' },
|
|
52
|
+
{ label: 'forty-third', value: 'forty-third' },
|
|
53
|
+
{ label: 'forty-fourth', value: 'forty-fourth' },
|
|
54
|
+
{ label: 'forty-fifth', value: 'forty-fifth' },
|
|
55
|
+
{ label: 'forty-sixth', value: 'forty-sixth' },
|
|
56
|
+
{ label: 'forty-seventh', value: 'forty-seventh' },
|
|
57
|
+
{ label: 'forty-eighth', value: 'forty-eighth' },
|
|
58
|
+
{ label: 'forty-ninth', value: 'forty-ninth' },
|
|
59
|
+
{ label: 'fiftieth', value: 'fiftieth' },
|
|
60
|
+
];
|
|
61
|
+
describe('AutocompletePrompt', async () => {
|
|
62
|
+
test('choose an answer', async () => {
|
|
63
|
+
const onEnter = vi.fn();
|
|
64
|
+
const items = [
|
|
65
|
+
{ label: 'first', value: 'first' },
|
|
66
|
+
{ label: 'second', value: 'second' },
|
|
67
|
+
{ label: 'third', value: 'third' },
|
|
68
|
+
];
|
|
69
|
+
const infoTable = { Add: ['new-ext'], Remove: ['integrated-demand-ext', 'order-discount'] };
|
|
70
|
+
const renderInstance = render(React.createElement(AutocompletePrompt, { message: "Associate your project with the org Castile Ventures?", choices: items, infoTable: infoTable, onSubmit: onEnter, search: () => Promise.resolve([]) }));
|
|
71
|
+
await waitForInputsToBeReady();
|
|
72
|
+
await sendInputAndWaitForChange(renderInstance, ARROW_DOWN);
|
|
73
|
+
await sendInputAndWaitForChange(renderInstance, ENTER);
|
|
74
|
+
expect(getLastFrameAfterUnmount(renderInstance)).toMatchInlineSnapshot(`
|
|
75
|
+
"? Associate your project with the org Castile Ventures?
|
|
76
|
+
[36m✔[39m [36msecond[39m
|
|
77
|
+
"
|
|
78
|
+
`);
|
|
79
|
+
expect(onEnter).toHaveBeenCalledWith(items[1].value);
|
|
80
|
+
});
|
|
81
|
+
test('renders groups', async () => {
|
|
82
|
+
const items = [
|
|
83
|
+
{ label: 'first', value: 'first', group: 'Automations', key: 'f' },
|
|
84
|
+
{ label: 'second', value: 'second', group: 'Automations', key: 's' },
|
|
85
|
+
{ label: 'third', value: 'third', group: 'Merchant Admin' },
|
|
86
|
+
{ label: 'fourth', value: 'fourth', group: 'Merchant Admin' },
|
|
87
|
+
{ label: 'fifth', value: 'fifth', key: 'a' },
|
|
88
|
+
{ label: 'sixth', value: 'sixth' },
|
|
89
|
+
{ label: 'seventh', value: 'seventh' },
|
|
90
|
+
{ label: 'eighth', value: 'eighth' },
|
|
91
|
+
{ label: 'ninth', value: 'ninth' },
|
|
92
|
+
{ label: 'tenth', value: 'tenth' },
|
|
93
|
+
];
|
|
94
|
+
const renderInstance = render(React.createElement(AutocompletePrompt, { message: "Associate your project with the org Castile Ventures?", choices: items, onSubmit: () => { }, search: () => Promise.resolve([]) }));
|
|
95
|
+
expect(renderInstance.lastFrame()).toMatchInlineSnapshot(`
|
|
96
|
+
"? Associate your project with the org Castile Ventures?
|
|
97
|
+
|
|
98
|
+
[1mAutomations[22m
|
|
99
|
+
[36m>[39m [36mfirst[39m
|
|
100
|
+
second
|
|
101
|
+
|
|
102
|
+
[1mMerchant Admin[22m
|
|
103
|
+
third
|
|
104
|
+
fourth
|
|
105
|
+
|
|
106
|
+
[1mOther[22m
|
|
107
|
+
fifth
|
|
108
|
+
sixth
|
|
109
|
+
seventh
|
|
110
|
+
eighth
|
|
111
|
+
ninth
|
|
112
|
+
tenth
|
|
113
|
+
|
|
114
|
+
[2mPress ↑↓ arrows to select, enter to confirm[22m
|
|
115
|
+
"
|
|
116
|
+
`);
|
|
117
|
+
});
|
|
118
|
+
test('supports an info table', async () => {
|
|
119
|
+
const items = [
|
|
120
|
+
{ label: 'first', value: 'first' },
|
|
121
|
+
{ label: 'second', value: 'second' },
|
|
122
|
+
{ label: 'third', value: 'third' },
|
|
123
|
+
{ label: 'fourth', value: 'fourth' },
|
|
124
|
+
];
|
|
125
|
+
const infoTable = {
|
|
126
|
+
Add: ['new-ext'],
|
|
127
|
+
Remove: ['integrated-demand-ext', 'order-discount'],
|
|
128
|
+
};
|
|
129
|
+
const renderInstance = render(React.createElement(AutocompletePrompt, { message: "Associate your project with the org Castile Ventures?", choices: items, infoTable: infoTable, onSubmit: () => { }, search: () => Promise.resolve([]) }));
|
|
130
|
+
expect(renderInstance.lastFrame()).toMatchInlineSnapshot(`
|
|
131
|
+
"? Associate your project with the org Castile Ventures?
|
|
132
|
+
|
|
133
|
+
Add: • new-ext
|
|
134
|
+
|
|
135
|
+
Remove: • integrated-demand-ext
|
|
136
|
+
• order-discount
|
|
137
|
+
|
|
138
|
+
[36m>[39m [36mfirst[39m
|
|
139
|
+
second
|
|
140
|
+
third
|
|
141
|
+
fourth
|
|
142
|
+
|
|
143
|
+
[2mPress ↑↓ arrows to select, enter to confirm[22m
|
|
144
|
+
"
|
|
145
|
+
`);
|
|
146
|
+
});
|
|
147
|
+
test("doesn't submit if there are no choices", async () => {
|
|
148
|
+
const onEnter = vi.fn();
|
|
149
|
+
const searchPromise = Promise.resolve([]);
|
|
150
|
+
const search = () => {
|
|
151
|
+
return searchPromise;
|
|
152
|
+
};
|
|
153
|
+
const renderInstance = render(React.createElement(AutocompletePrompt, { message: "Associate your project with the org Castile Ventures?", choices: DATABASE, onSubmit: onEnter, search: search }));
|
|
154
|
+
await waitForInputsToBeReady();
|
|
155
|
+
await sendInputAndWaitForContent(renderInstance, 'No results found', 'a');
|
|
156
|
+
// prompt doesn't change when enter is pressed
|
|
157
|
+
await sendInputAndWait(renderInstance, 100, ENTER);
|
|
158
|
+
expect(getLastFrameAfterUnmount(renderInstance)).toMatchInlineSnapshot(`
|
|
159
|
+
"? Associate your project with the org Castile Ventures? [36ma[7m [27m[39m
|
|
160
|
+
|
|
161
|
+
[2mNo results found.[22m
|
|
162
|
+
"
|
|
163
|
+
`);
|
|
164
|
+
expect(onEnter).not.toHaveBeenCalled();
|
|
165
|
+
});
|
|
166
|
+
test('has a loading state', async () => {
|
|
167
|
+
const onEnter = vi.fn();
|
|
168
|
+
const searchPromise = new Promise((resolve) => {
|
|
169
|
+
setTimeout(() => resolve([{ label: 'a', value: 'b' }]), 2000);
|
|
170
|
+
});
|
|
171
|
+
const search = () => {
|
|
172
|
+
return searchPromise;
|
|
173
|
+
};
|
|
174
|
+
const renderInstance = render(React.createElement(AutocompletePrompt, { message: "Associate your project with the org Castile Ventures?", choices: DATABASE, onSubmit: onEnter, search: search }));
|
|
175
|
+
await waitForInputsToBeReady();
|
|
176
|
+
await sendInputAndWaitForContent(renderInstance, 'Loading...', 'a');
|
|
177
|
+
// prompt doesn't change when enter is pressed
|
|
178
|
+
await sendInputAndWait(renderInstance, 100, ENTER);
|
|
179
|
+
expect(getLastFrameAfterUnmount(renderInstance)).toMatchInlineSnapshot(`
|
|
180
|
+
"? Associate your project with the org Castile Ventures? [36ma[7m [27m[39m
|
|
181
|
+
|
|
182
|
+
[2mLoading...[22m
|
|
183
|
+
"
|
|
184
|
+
`);
|
|
185
|
+
expect(onEnter).not.toHaveBeenCalled();
|
|
186
|
+
});
|
|
187
|
+
test('allows searching with pagination', async () => {
|
|
188
|
+
const onEnter = vi.fn();
|
|
189
|
+
const search = async (term) => {
|
|
190
|
+
return DATABASE.filter((item) => item.label.includes(term));
|
|
191
|
+
};
|
|
192
|
+
const renderInstance = render(React.createElement(AutocompletePrompt, { message: "Associate your project with the org Castile Ventures?", choices: DATABASE, onSubmit: onEnter, search: search }));
|
|
193
|
+
expect(renderInstance.lastFrame()).toMatchInlineSnapshot(`
|
|
194
|
+
"? Associate your project with the org Castile Ventures? [36m[7mT[27m[2mype to search...[22m[39m
|
|
195
|
+
|
|
196
|
+
[36m>[39m [36mfirst[39m
|
|
197
|
+
second
|
|
198
|
+
third
|
|
199
|
+
fourth
|
|
200
|
+
fifth
|
|
201
|
+
sixth
|
|
202
|
+
seventh
|
|
203
|
+
eighth
|
|
204
|
+
ninth
|
|
205
|
+
tenth
|
|
206
|
+
eleventh
|
|
207
|
+
twelfth
|
|
208
|
+
thirteenth
|
|
209
|
+
fourteenth
|
|
210
|
+
fifteenth
|
|
211
|
+
sixteenth
|
|
212
|
+
seventeenth
|
|
213
|
+
eighteenth
|
|
214
|
+
nineteenth
|
|
215
|
+
twentieth
|
|
216
|
+
twenty-first
|
|
217
|
+
twenty-second
|
|
218
|
+
twenty-third
|
|
219
|
+
twenty-fourth
|
|
220
|
+
twenty-fifth
|
|
221
|
+
|
|
222
|
+
[2mPress ↑↓ arrows to select, enter to confirm[22m
|
|
223
|
+
"
|
|
224
|
+
`);
|
|
225
|
+
await waitForInputsToBeReady();
|
|
226
|
+
await sendInputAndWaitForContent(renderInstance, 'th[1mi[22mrty-sixth', 'i');
|
|
227
|
+
expect(renderInstance.lastFrame()).toMatchInlineSnapshot(`
|
|
228
|
+
"? Associate your project with the org Castile Ventures? [36mi[7m [27m[39m
|
|
229
|
+
|
|
230
|
+
[36m>[39m [36mf[1mi[22mrst[39m
|
|
231
|
+
th[1mi[22mrd
|
|
232
|
+
f[1mi[22mfth
|
|
233
|
+
s[1mi[22mxth
|
|
234
|
+
e[1mi[22mghth
|
|
235
|
+
n[1mi[22mnth
|
|
236
|
+
th[1mi[22mrteenth
|
|
237
|
+
f[1mi[22mfteenth
|
|
238
|
+
s[1mi[22mxteenth
|
|
239
|
+
e[1mi[22mghteenth
|
|
240
|
+
n[1mi[22mneteenth
|
|
241
|
+
twent[1mi[22meth
|
|
242
|
+
twenty-f[1mi[22mrst
|
|
243
|
+
twenty-th[1mi[22mrd
|
|
244
|
+
twenty-f[1mi[22mfth
|
|
245
|
+
twenty-s[1mi[22mxth
|
|
246
|
+
twenty-e[1mi[22mghth
|
|
247
|
+
twenty-n[1mi[22mnth
|
|
248
|
+
th[1mi[22mrtieth
|
|
249
|
+
th[1mi[22mrty-first
|
|
250
|
+
th[1mi[22mrty-second
|
|
251
|
+
th[1mi[22mrty-third
|
|
252
|
+
th[1mi[22mrty-fourth
|
|
253
|
+
th[1mi[22mrty-fifth
|
|
254
|
+
th[1mi[22mrty-sixth
|
|
255
|
+
|
|
256
|
+
[2mPress ↑↓ arrows to select, enter to confirm[22m
|
|
257
|
+
"
|
|
258
|
+
`);
|
|
259
|
+
await sendInputAndWaitForChange(renderInstance, DELETE);
|
|
260
|
+
expect(renderInstance.lastFrame()).toMatchInlineSnapshot(`
|
|
261
|
+
"? Associate your project with the org Castile Ventures? [36m[7mT[27m[2mype to search...[22m[39m
|
|
262
|
+
|
|
263
|
+
[36m>[39m [36mfirst[39m
|
|
264
|
+
second
|
|
265
|
+
third
|
|
266
|
+
fourth
|
|
267
|
+
fifth
|
|
268
|
+
sixth
|
|
269
|
+
seventh
|
|
270
|
+
eighth
|
|
271
|
+
ninth
|
|
272
|
+
tenth
|
|
273
|
+
eleventh
|
|
274
|
+
twelfth
|
|
275
|
+
thirteenth
|
|
276
|
+
fourteenth
|
|
277
|
+
fifteenth
|
|
278
|
+
sixteenth
|
|
279
|
+
seventeenth
|
|
280
|
+
eighteenth
|
|
281
|
+
nineteenth
|
|
282
|
+
twentieth
|
|
283
|
+
twenty-first
|
|
284
|
+
twenty-second
|
|
285
|
+
twenty-third
|
|
286
|
+
twenty-fourth
|
|
287
|
+
twenty-fifth
|
|
288
|
+
|
|
289
|
+
[2mPress ↑↓ arrows to select, enter to confirm[22m
|
|
290
|
+
"
|
|
291
|
+
`);
|
|
292
|
+
await sendInputAndWaitForContent(renderInstance, 'th[1mi[22mrty-sixth', 'i');
|
|
293
|
+
await sendInputAndWaitForChange(renderInstance, ARROW_DOWN);
|
|
294
|
+
await sendInputAndWaitForChange(renderInstance, ARROW_DOWN);
|
|
295
|
+
expect(renderInstance.lastFrame()).toMatchInlineSnapshot(`
|
|
296
|
+
"? Associate your project with the org Castile Ventures? [36mi[7m [27m[39m
|
|
297
|
+
|
|
298
|
+
f[1mi[22mrst
|
|
299
|
+
th[1mi[22mrd
|
|
300
|
+
[36m>[39m [36mf[1mi[22mfth[39m
|
|
301
|
+
s[1mi[22mxth
|
|
302
|
+
e[1mi[22mghth
|
|
303
|
+
n[1mi[22mnth
|
|
304
|
+
th[1mi[22mrteenth
|
|
305
|
+
f[1mi[22mfteenth
|
|
306
|
+
s[1mi[22mxteenth
|
|
307
|
+
e[1mi[22mghteenth
|
|
308
|
+
n[1mi[22mneteenth
|
|
309
|
+
twent[1mi[22meth
|
|
310
|
+
twenty-f[1mi[22mrst
|
|
311
|
+
twenty-th[1mi[22mrd
|
|
312
|
+
twenty-f[1mi[22mfth
|
|
313
|
+
twenty-s[1mi[22mxth
|
|
314
|
+
twenty-e[1mi[22mghth
|
|
315
|
+
twenty-n[1mi[22mnth
|
|
316
|
+
th[1mi[22mrtieth
|
|
317
|
+
th[1mi[22mrty-first
|
|
318
|
+
th[1mi[22mrty-second
|
|
319
|
+
th[1mi[22mrty-third
|
|
320
|
+
th[1mi[22mrty-fourth
|
|
321
|
+
th[1mi[22mrty-fifth
|
|
322
|
+
th[1mi[22mrty-sixth
|
|
323
|
+
|
|
324
|
+
[2mPress ↑↓ arrows to select, enter to confirm[22m
|
|
325
|
+
"
|
|
326
|
+
`);
|
|
327
|
+
await sendInputAndWaitForChange(renderInstance, ENTER);
|
|
328
|
+
expect(getLastFrameAfterUnmount(renderInstance)).toMatchInlineSnapshot(`
|
|
329
|
+
"? Associate your project with the org Castile Ventures?
|
|
330
|
+
[36m✔[39m [36mfifth[39m
|
|
331
|
+
"
|
|
332
|
+
`);
|
|
333
|
+
expect(onEnter).toHaveBeenCalledWith('fifth');
|
|
334
|
+
});
|
|
335
|
+
test('allows selecting the first item after searching and triggering the loading state', async () => {
|
|
336
|
+
const onEnter = vi.fn();
|
|
337
|
+
const search = async (term) => {
|
|
338
|
+
await new Promise((resolve) => setTimeout(resolve, 300));
|
|
339
|
+
return DATABASE.filter((item) => item.label.includes(term));
|
|
340
|
+
};
|
|
341
|
+
const renderInstance = render(React.createElement(AutocompletePrompt, { message: "Associate your project with the org Castile Ventures?", choices: DATABASE, onSubmit: onEnter, search: search }));
|
|
342
|
+
await waitForInputsToBeReady();
|
|
343
|
+
await sendInputAndWaitForContent(renderInstance, 'Loading...', 'e');
|
|
344
|
+
await waitForContent(renderInstance, 'Press ↑↓ arrows to select, enter to confirm');
|
|
345
|
+
expect(renderInstance.lastFrame()).toMatchInlineSnapshot(`
|
|
346
|
+
"? Associate your project with the org Castile Ventures? [36me[7m [27m[39m
|
|
347
|
+
|
|
348
|
+
[36m>[39m [36ms[1me[22mcond[39m
|
|
349
|
+
s[1me[22mventh
|
|
350
|
+
[1me[22mighth
|
|
351
|
+
t[1me[22mnth
|
|
352
|
+
[1me[22mleventh
|
|
353
|
+
tw[1me[22mlfth
|
|
354
|
+
thirt[1me[22menth
|
|
355
|
+
fourt[1me[22menth
|
|
356
|
+
fift[1me[22menth
|
|
357
|
+
sixt[1me[22menth
|
|
358
|
+
s[1me[22mventeenth
|
|
359
|
+
[1me[22mighteenth
|
|
360
|
+
nin[1me[22mteenth
|
|
361
|
+
tw[1me[22mntieth
|
|
362
|
+
tw[1me[22mnty-first
|
|
363
|
+
tw[1me[22mnty-second
|
|
364
|
+
tw[1me[22mnty-third
|
|
365
|
+
tw[1me[22mnty-fourth
|
|
366
|
+
tw[1me[22mnty-fifth
|
|
367
|
+
tw[1me[22mnty-sixth
|
|
368
|
+
tw[1me[22mnty-seventh
|
|
369
|
+
tw[1me[22mnty-eighth
|
|
370
|
+
tw[1me[22mnty-ninth
|
|
371
|
+
thirti[1me[22mth
|
|
372
|
+
thirty-s[1me[22mcond
|
|
373
|
+
|
|
374
|
+
[2mPress ↑↓ arrows to select, enter to confirm[22m
|
|
375
|
+
"
|
|
376
|
+
`);
|
|
377
|
+
await sendInputAndWaitForChange(renderInstance, ENTER);
|
|
378
|
+
expect(getLastFrameAfterUnmount(renderInstance)).toMatchInlineSnapshot(`
|
|
379
|
+
"? Associate your project with the org Castile Ventures?
|
|
380
|
+
[36m✔[39m [36msecond[39m
|
|
381
|
+
"
|
|
382
|
+
`);
|
|
383
|
+
expect(onEnter).toHaveBeenCalledWith('second');
|
|
384
|
+
});
|
|
385
|
+
test('displays an error message if the search fails', async () => {
|
|
386
|
+
const search = (_term) => {
|
|
387
|
+
return Promise.reject(new Error('Something went wrong'));
|
|
388
|
+
};
|
|
389
|
+
const renderInstance = render(React.createElement(AutocompletePrompt, { message: "Associate your project with the org Castile Ventures?", choices: DATABASE, onSubmit: () => { }, search: search }));
|
|
390
|
+
await waitForInputsToBeReady();
|
|
391
|
+
await sendInputAndWaitForContent(renderInstance, 'There has been an error', 'i');
|
|
392
|
+
expect(renderInstance.lastFrame()).toMatchInlineSnapshot(`
|
|
393
|
+
"? Associate your project with the org Castile Ventures? [36mi[7m [27m[39m
|
|
394
|
+
|
|
395
|
+
[31mThere has been an error while searching. Please try again later.[39m
|
|
396
|
+
"
|
|
397
|
+
`);
|
|
398
|
+
});
|
|
399
|
+
test('immediately shows the initial items if the search is empty', async () => {
|
|
400
|
+
const search = (term) => {
|
|
401
|
+
return Promise.resolve(DATABASE.filter((item) => item.label.includes(term)));
|
|
402
|
+
};
|
|
403
|
+
const renderInstance = render(React.createElement(AutocompletePrompt, { message: "Associate your project with the org Castile Ventures?", choices: DATABASE, onSubmit: () => { }, search: search }));
|
|
404
|
+
await waitForInputsToBeReady();
|
|
405
|
+
await sendInputAndWaitForContent(renderInstance, 'th[1mi[22mrty-sixth', 'i');
|
|
406
|
+
expect(renderInstance.lastFrame()).toMatchInlineSnapshot(`
|
|
407
|
+
"? Associate your project with the org Castile Ventures? [36mi[7m [27m[39m
|
|
408
|
+
|
|
409
|
+
[36m>[39m [36mf[1mi[22mrst[39m
|
|
410
|
+
th[1mi[22mrd
|
|
411
|
+
f[1mi[22mfth
|
|
412
|
+
s[1mi[22mxth
|
|
413
|
+
e[1mi[22mghth
|
|
414
|
+
n[1mi[22mnth
|
|
415
|
+
th[1mi[22mrteenth
|
|
416
|
+
f[1mi[22mfteenth
|
|
417
|
+
s[1mi[22mxteenth
|
|
418
|
+
e[1mi[22mghteenth
|
|
419
|
+
n[1mi[22mneteenth
|
|
420
|
+
twent[1mi[22meth
|
|
421
|
+
twenty-f[1mi[22mrst
|
|
422
|
+
twenty-th[1mi[22mrd
|
|
423
|
+
twenty-f[1mi[22mfth
|
|
424
|
+
twenty-s[1mi[22mxth
|
|
425
|
+
twenty-e[1mi[22mghth
|
|
426
|
+
twenty-n[1mi[22mnth
|
|
427
|
+
th[1mi[22mrtieth
|
|
428
|
+
th[1mi[22mrty-first
|
|
429
|
+
th[1mi[22mrty-second
|
|
430
|
+
th[1mi[22mrty-third
|
|
431
|
+
th[1mi[22mrty-fourth
|
|
432
|
+
th[1mi[22mrty-fifth
|
|
433
|
+
th[1mi[22mrty-sixth
|
|
434
|
+
|
|
435
|
+
[2mPress ↑↓ arrows to select, enter to confirm[22m
|
|
436
|
+
"
|
|
437
|
+
`);
|
|
438
|
+
await sendInputAndWaitForChange(renderInstance, DELETE);
|
|
439
|
+
expect(renderInstance.lastFrame()).toMatchInlineSnapshot(`
|
|
440
|
+
"? Associate your project with the org Castile Ventures? [36m[7mT[27m[2mype to search...[22m[39m
|
|
441
|
+
|
|
442
|
+
[36m>[39m [36mfirst[39m
|
|
443
|
+
second
|
|
444
|
+
third
|
|
445
|
+
fourth
|
|
446
|
+
fifth
|
|
447
|
+
sixth
|
|
448
|
+
seventh
|
|
449
|
+
eighth
|
|
450
|
+
ninth
|
|
451
|
+
tenth
|
|
452
|
+
eleventh
|
|
453
|
+
twelfth
|
|
454
|
+
thirteenth
|
|
455
|
+
fourteenth
|
|
456
|
+
fifteenth
|
|
457
|
+
sixteenth
|
|
458
|
+
seventeenth
|
|
459
|
+
eighteenth
|
|
460
|
+
nineteenth
|
|
461
|
+
twentieth
|
|
462
|
+
twenty-first
|
|
463
|
+
twenty-second
|
|
464
|
+
twenty-third
|
|
465
|
+
twenty-fourth
|
|
466
|
+
twenty-fifth
|
|
467
|
+
|
|
468
|
+
[2mPress ↑↓ arrows to select, enter to confirm[22m
|
|
469
|
+
"
|
|
470
|
+
`);
|
|
471
|
+
});
|
|
472
|
+
});
|
|
473
|
+
//# sourceMappingURL=AutocompletePrompt.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AutocompletePrompt.test.js","sourceRoot":"","sources":["../../../../../src/private/node/ui/components/AutocompletePrompt.test.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,kBAAkB,EAAC,MAAM,yBAAyB,CAAA;AAE1D,OAAO,EACL,wBAAwB,EACxB,gBAAgB,EAChB,yBAAyB,EACzB,0BAA0B,EAC1B,cAAc,EACd,sBAAsB,GACvB,MAAM,2BAA2B,CAAA;AAClC,OAAO,EAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAC,MAAM,QAAQ,CAAA;AACjD,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAC,MAAM,EAAC,MAAM,qBAAqB,CAAA;AAE1C,MAAM,UAAU,GAAG,UAAU,CAAA;AAC7B,MAAM,KAAK,GAAG,IAAI,CAAA;AAClB,MAAM,MAAM,GAAG,QAAQ,CAAA;AAEvB,MAAM,QAAQ,GAAG;IACf,EAAC,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAC;IAChC,EAAC,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAC;IAClC,EAAC,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAC;IAChC,EAAC,KAAK,EAAE,QAAQ,EAAE,KAAK,EAA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,IAAI,CAAC,4DAA4D,EAAE,KAAK,IAAI,EAAE;QAC5E,MAAM,MAAM,GAAG,CAAC,IAAY,EAAE,EAAE;YAC9B,OAAO,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;QAC9E,CAAC,CAAA;QAED,MAAM,cAAc,GAAG,MAAM,CAC3B,oBAAC,kBAAkB,IACjB,OAAO,EAAC,uDAAuD,EAC/D,OAAO,EAAE,QAAQ,EACjB,QAAQ,EAAE,GAAG,EAAE,GAAE,CAAC,EAClB,MAAM,EAAE,MAAM,GACd,CACH,CAAA;QAED,MAAM,sBAAsB,EAAE,CAAA;QAC9B,MAAM,0BAA0B,CAAC,cAAc,EAAE,uBAAuB,EAAE,GAAG,CAAC,CAAA;QAE9E,MAAM,CAAC,cAAc,CAAC,SAAS,EAAE,CAAC,CAAC,qBAAqB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA+BxD,CAAC,CAAA;QAEF,MAAM,yBAAyB,CAAC,cAAc,EAAE,MAAM,CAAC,CAAA;QAEvD,MAAM,CAAC,cAAc,CAAC,SAAS,EAAE,CAAC,CAAC,qBAAqB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA+BxD,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA","sourcesContent":["import {AutocompletePrompt} from './AutocompletePrompt.js'\nimport {Item} from './SelectInput.js'\nimport {\n getLastFrameAfterUnmount,\n sendInputAndWait,\n sendInputAndWaitForChange,\n sendInputAndWaitForContent,\n waitForContent,\n waitForInputsToBeReady,\n} from '../../../../testing/ui.js'\nimport {describe, expect, test, vi} from 'vitest'\nimport React from 'react'\nimport {render} from 'ink-testing-library'\n\nconst ARROW_DOWN = '\\u001B[B'\nconst ENTER = '\\r'\nconst DELETE = '\\u007F'\n\nconst DATABASE = [\n {label: 'first', value: 'first'},\n {label: 'second', value: 'second'},\n {label: 'third', value: 'third'},\n {label: 'fourth', value: 'fourth'},\n {label: 'fifth', value: 'fifth'},\n {label: 'sixth', value: 'sixth'},\n {label: 'seventh', value: 'seventh'},\n {label: 'eighth', value: 'eighth'},\n {label: 'ninth', value: 'ninth'},\n {label: 'tenth', value: 'tenth'},\n {label: 'eleventh', value: 'eleventh'},\n {label: 'twelfth', value: 'twelfth'},\n {label: 'thirteenth', value: 'thirteenth'},\n {label: 'fourteenth', value: 'fourteenth'},\n {label: 'fifteenth', value: 'fifteenth'},\n {label: 'sixteenth', value: 'sixteenth'},\n {label: 'seventeenth', value: 'seventeenth'},\n {label: 'eighteenth', value: 'eighteenth'},\n {label: 'nineteenth', value: 'nineteenth'},\n {label: 'twentieth', value: 'twentieth'},\n {label: 'twenty-first', value: 'twenty-first'},\n {label: 'twenty-second', value: 'twenty-second'},\n {label: 'twenty-third', value: 'twenty-third'},\n {label: 'twenty-fourth', value: 'twenty-fourth'},\n {label: 'twenty-fifth', value: 'twenty-fifth'},\n {label: 'twenty-sixth', value: 'twenty-sixth'},\n {label: 'twenty-seventh', value: 'twenty-seventh'},\n {label: 'twenty-eighth', value: 'twenty-eighth'},\n {label: 'twenty-ninth', value: 'twenty-ninth'},\n {label: 'thirtieth', value: 'thirtieth'},\n {label: 'thirty-first', value: 'thirty-first'},\n {label: 'thirty-second', value: 'thirty-second'},\n {label: 'thirty-third', value: 'thirty-third'},\n {label: 'thirty-fourth', value: 'thirty-fourth'},\n {label: 'thirty-fifth', value: 'thirty-fifth'},\n {label: 'thirty-sixth', value: 'thirty-sixth'},\n {label: 'thirty-seventh', value: 'thirty-seventh'},\n {label: 'thirty-eighth', value: 'thirty-eighth'},\n {label: 'thirty-ninth', value: 'thirty-ninth'},\n {label: 'fortieth', value: 'fortieth'},\n {label: 'forty-first', value: 'forty-first'},\n {label: 'forty-second', value: 'forty-second'},\n {label: 'forty-third', value: 'forty-third'},\n {label: 'forty-fourth', value: 'forty-fourth'},\n {label: 'forty-fifth', value: 'forty-fifth'},\n {label: 'forty-sixth', value: 'forty-sixth'},\n {label: 'forty-seventh', value: 'forty-seventh'},\n {label: 'forty-eighth', value: 'forty-eighth'},\n {label: 'forty-ninth', value: 'forty-ninth'},\n {label: 'fiftieth', value: 'fiftieth'},\n]\n\ndescribe('AutocompletePrompt', async () => {\n test('choose an answer', async () => {\n const onEnter = vi.fn()\n\n const items = [\n {label: 'first', value: 'first'},\n {label: 'second', value: 'second'},\n {label: 'third', value: 'third'},\n ]\n\n const infoTable = {Add: ['new-ext'], Remove: ['integrated-demand-ext', 'order-discount']}\n\n const renderInstance = render(\n <AutocompletePrompt\n message=\"Associate your project with the org Castile Ventures?\"\n choices={items}\n infoTable={infoTable}\n onSubmit={onEnter}\n search={() => Promise.resolve([] as Item<string>[])}\n />,\n )\n\n await waitForInputsToBeReady()\n await sendInputAndWaitForChange(renderInstance, ARROW_DOWN)\n await sendInputAndWaitForChange(renderInstance, ENTER)\n\n expect(getLastFrameAfterUnmount(renderInstance)).toMatchInlineSnapshot(`\n \"? Associate your project with the org Castile Ventures?\n \u001b[36m✔\u001b[39m \u001b[36msecond\u001b[39m\n \"\n `)\n\n expect(onEnter).toHaveBeenCalledWith(items[1]!.value)\n })\n\n test('renders groups', async () => {\n const items = [\n {label: 'first', value: 'first', group: 'Automations', key: 'f'},\n {label: 'second', value: 'second', group: 'Automations', key: 's'},\n {label: 'third', value: 'third', group: 'Merchant Admin'},\n {label: 'fourth', value: 'fourth', group: 'Merchant Admin'},\n {label: 'fifth', value: 'fifth', key: 'a'},\n {label: 'sixth', value: 'sixth'},\n {label: 'seventh', value: 'seventh'},\n {label: 'eighth', value: 'eighth'},\n {label: 'ninth', value: 'ninth'},\n {label: 'tenth', value: 'tenth'},\n ]\n\n const renderInstance = render(\n <AutocompletePrompt\n message=\"Associate your project with the org Castile Ventures?\"\n choices={items}\n onSubmit={() => {}}\n search={() => Promise.resolve([] as Item<string>[])}\n />,\n )\n\n expect(renderInstance.lastFrame()).toMatchInlineSnapshot(`\n \"? Associate your project with the org Castile Ventures?\n\n \u001b[1mAutomations\u001b[22m\n \u001b[36m>\u001b[39m \u001b[36mfirst\u001b[39m\n second\n\n \u001b[1mMerchant Admin\u001b[22m\n third\n fourth\n\n \u001b[1mOther\u001b[22m\n fifth\n sixth\n seventh\n eighth\n ninth\n tenth\n\n \u001b[2mPress ↑↓ arrows to select, enter to confirm\u001b[22m\n \"\n `)\n })\n\n test('supports an info table', async () => {\n const items = [\n {label: 'first', value: 'first'},\n {label: 'second', value: 'second'},\n {label: 'third', value: 'third'},\n {label: 'fourth', value: 'fourth'},\n ]\n\n const infoTable = {\n Add: ['new-ext'],\n Remove: ['integrated-demand-ext', 'order-discount'],\n }\n\n const renderInstance = render(\n <AutocompletePrompt\n message=\"Associate your project with the org Castile Ventures?\"\n choices={items}\n infoTable={infoTable}\n onSubmit={() => {}}\n search={() => Promise.resolve([] as Item<string>[])}\n />,\n )\n\n expect(renderInstance.lastFrame()).toMatchInlineSnapshot(`\n \"? Associate your project with the org Castile Ventures?\n\n Add: • new-ext\n\n Remove: • integrated-demand-ext\n • order-discount\n\n \u001b[36m>\u001b[39m \u001b[36mfirst\u001b[39m\n second\n third\n fourth\n\n \u001b[2mPress ↑↓ arrows to select, enter to confirm\u001b[22m\n \"\n `)\n })\n\n test(\"doesn't submit if there are no choices\", async () => {\n const onEnter = vi.fn()\n const searchPromise = Promise.resolve([] as Item<string>[])\n const search = () => {\n return searchPromise\n }\n\n const renderInstance = render(\n <AutocompletePrompt\n message=\"Associate your project with the org Castile Ventures?\"\n choices={DATABASE}\n onSubmit={onEnter}\n search={search}\n />,\n )\n\n await waitForInputsToBeReady()\n await sendInputAndWaitForContent(renderInstance, 'No results found', 'a')\n // prompt doesn't change when enter is pressed\n await sendInputAndWait(renderInstance, 100, ENTER)\n\n expect(getLastFrameAfterUnmount(renderInstance)).toMatchInlineSnapshot(`\n \"? Associate your project with the org Castile Ventures? \u001b[36ma\u001b[7m \u001b[27m\u001b[39m\n\n \u001b[2mNo results found.\u001b[22m\n \"\n `)\n\n expect(onEnter).not.toHaveBeenCalled()\n })\n\n test('has a loading state', async () => {\n const onEnter = vi.fn()\n const searchPromise = new Promise<Item<string>[]>((resolve) => {\n setTimeout(() => resolve([{label: 'a', value: 'b'}]), 2000)\n })\n\n const search = () => {\n return searchPromise\n }\n\n const renderInstance = render(\n <AutocompletePrompt\n message=\"Associate your project with the org Castile Ventures?\"\n choices={DATABASE}\n onSubmit={onEnter}\n search={search}\n />,\n )\n\n await waitForInputsToBeReady()\n await sendInputAndWaitForContent(renderInstance, 'Loading...', 'a')\n // prompt doesn't change when enter is pressed\n await sendInputAndWait(renderInstance, 100, ENTER)\n\n expect(getLastFrameAfterUnmount(renderInstance)).toMatchInlineSnapshot(`\n \"? Associate your project with the org Castile Ventures? \u001b[36ma\u001b[7m \u001b[27m\u001b[39m\n\n \u001b[2mLoading...\u001b[22m\n \"\n `)\n\n expect(onEnter).not.toHaveBeenCalled()\n })\n\n test('allows searching with pagination', async () => {\n const onEnter = vi.fn()\n\n const search = async (term: string) => {\n return DATABASE.filter((item) => item.label.includes(term))\n }\n\n const renderInstance = render(\n <AutocompletePrompt\n message=\"Associate your project with the org Castile Ventures?\"\n choices={DATABASE}\n onSubmit={onEnter}\n search={search}\n />,\n )\n\n expect(renderInstance.lastFrame()).toMatchInlineSnapshot(`\n \"? Associate your project with the org Castile Ventures? \u001b[36m\u001b[7mT\u001b[27m\u001b[2mype to search...\u001b[22m\u001b[39m\n\n \u001b[36m>\u001b[39m \u001b[36mfirst\u001b[39m\n second\n third\n fourth\n fifth\n sixth\n seventh\n eighth\n ninth\n tenth\n eleventh\n twelfth\n thirteenth\n fourteenth\n fifteenth\n sixteenth\n seventeenth\n eighteenth\n nineteenth\n twentieth\n twenty-first\n twenty-second\n twenty-third\n twenty-fourth\n twenty-fifth\n\n \u001b[2mPress ↑↓ arrows to select, enter to confirm\u001b[22m\n \"\n `)\n\n await waitForInputsToBeReady()\n await sendInputAndWaitForContent(renderInstance, 'th\u001b[1mi\u001b[22mrty-sixth', 'i')\n\n expect(renderInstance.lastFrame()).toMatchInlineSnapshot(`\n \"? Associate your project with the org Castile Ventures? \u001b[36mi\u001b[7m \u001b[27m\u001b[39m\n\n \u001b[36m>\u001b[39m \u001b[36mf\u001b[1mi\u001b[22mrst\u001b[39m\n th\u001b[1mi\u001b[22mrd\n f\u001b[1mi\u001b[22mfth\n s\u001b[1mi\u001b[22mxth\n e\u001b[1mi\u001b[22mghth\n n\u001b[1mi\u001b[22mnth\n th\u001b[1mi\u001b[22mrteenth\n f\u001b[1mi\u001b[22mfteenth\n s\u001b[1mi\u001b[22mxteenth\n e\u001b[1mi\u001b[22mghteenth\n n\u001b[1mi\u001b[22mneteenth\n twent\u001b[1mi\u001b[22meth\n twenty-f\u001b[1mi\u001b[22mrst\n twenty-th\u001b[1mi\u001b[22mrd\n twenty-f\u001b[1mi\u001b[22mfth\n twenty-s\u001b[1mi\u001b[22mxth\n twenty-e\u001b[1mi\u001b[22mghth\n twenty-n\u001b[1mi\u001b[22mnth\n th\u001b[1mi\u001b[22mrtieth\n th\u001b[1mi\u001b[22mrty-first\n th\u001b[1mi\u001b[22mrty-second\n th\u001b[1mi\u001b[22mrty-third\n th\u001b[1mi\u001b[22mrty-fourth\n th\u001b[1mi\u001b[22mrty-fifth\n th\u001b[1mi\u001b[22mrty-sixth\n\n \u001b[2mPress ↑↓ arrows to select, enter to confirm\u001b[22m\n \"\n `)\n\n await sendInputAndWaitForChange(renderInstance, DELETE)\n\n expect(renderInstance.lastFrame()).toMatchInlineSnapshot(`\n \"? Associate your project with the org Castile Ventures? \u001b[36m\u001b[7mT\u001b[27m\u001b[2mype to search...\u001b[22m\u001b[39m\n\n \u001b[36m>\u001b[39m \u001b[36mfirst\u001b[39m\n second\n third\n fourth\n fifth\n sixth\n seventh\n eighth\n ninth\n tenth\n eleventh\n twelfth\n thirteenth\n fourteenth\n fifteenth\n sixteenth\n seventeenth\n eighteenth\n nineteenth\n twentieth\n twenty-first\n twenty-second\n twenty-third\n twenty-fourth\n twenty-fifth\n\n \u001b[2mPress ↑↓ arrows to select, enter to confirm\u001b[22m\n \"\n `)\n\n await sendInputAndWaitForContent(renderInstance, 'th\u001b[1mi\u001b[22mrty-sixth', 'i')\n await sendInputAndWaitForChange(renderInstance, ARROW_DOWN)\n await sendInputAndWaitForChange(renderInstance, ARROW_DOWN)\n\n expect(renderInstance.lastFrame()).toMatchInlineSnapshot(`\n \"? Associate your project with the org Castile Ventures? \u001b[36mi\u001b[7m \u001b[27m\u001b[39m\n\n f\u001b[1mi\u001b[22mrst\n th\u001b[1mi\u001b[22mrd\n \u001b[36m>\u001b[39m \u001b[36mf\u001b[1mi\u001b[22mfth\u001b[39m\n s\u001b[1mi\u001b[22mxth\n e\u001b[1mi\u001b[22mghth\n n\u001b[1mi\u001b[22mnth\n th\u001b[1mi\u001b[22mrteenth\n f\u001b[1mi\u001b[22mfteenth\n s\u001b[1mi\u001b[22mxteenth\n e\u001b[1mi\u001b[22mghteenth\n n\u001b[1mi\u001b[22mneteenth\n twent\u001b[1mi\u001b[22meth\n twenty-f\u001b[1mi\u001b[22mrst\n twenty-th\u001b[1mi\u001b[22mrd\n twenty-f\u001b[1mi\u001b[22mfth\n twenty-s\u001b[1mi\u001b[22mxth\n twenty-e\u001b[1mi\u001b[22mghth\n twenty-n\u001b[1mi\u001b[22mnth\n th\u001b[1mi\u001b[22mrtieth\n th\u001b[1mi\u001b[22mrty-first\n th\u001b[1mi\u001b[22mrty-second\n th\u001b[1mi\u001b[22mrty-third\n th\u001b[1mi\u001b[22mrty-fourth\n th\u001b[1mi\u001b[22mrty-fifth\n th\u001b[1mi\u001b[22mrty-sixth\n\n \u001b[2mPress ↑↓ arrows to select, enter to confirm\u001b[22m\n \"\n `)\n\n await sendInputAndWaitForChange(renderInstance, ENTER)\n\n expect(getLastFrameAfterUnmount(renderInstance)).toMatchInlineSnapshot(`\n \"? Associate your project with the org Castile Ventures?\n \u001b[36m✔\u001b[39m \u001b[36mfifth\u001b[39m\n \"\n `)\n\n expect(onEnter).toHaveBeenCalledWith('fifth')\n })\n\n test('allows selecting the first item after searching and triggering the loading state', async () => {\n const onEnter = vi.fn()\n\n const search = async (term: string) => {\n await new Promise((resolve) => setTimeout(resolve, 300))\n return DATABASE.filter((item) => item.label.includes(term))\n }\n\n const renderInstance = render(\n <AutocompletePrompt\n message=\"Associate your project with the org Castile Ventures?\"\n choices={DATABASE}\n onSubmit={onEnter}\n search={search}\n />,\n )\n\n await waitForInputsToBeReady()\n await sendInputAndWaitForContent(renderInstance, 'Loading...', 'e')\n await waitForContent(renderInstance, 'Press ↑↓ arrows to select, enter to confirm')\n\n expect(renderInstance.lastFrame()).toMatchInlineSnapshot(`\n \"? Associate your project with the org Castile Ventures? \u001b[36me\u001b[7m \u001b[27m\u001b[39m\n\n \u001b[36m>\u001b[39m \u001b[36ms\u001b[1me\u001b[22mcond\u001b[39m\n s\u001b[1me\u001b[22mventh\n \u001b[1me\u001b[22mighth\n t\u001b[1me\u001b[22mnth\n \u001b[1me\u001b[22mleventh\n tw\u001b[1me\u001b[22mlfth\n thirt\u001b[1me\u001b[22menth\n fourt\u001b[1me\u001b[22menth\n fift\u001b[1me\u001b[22menth\n sixt\u001b[1me\u001b[22menth\n s\u001b[1me\u001b[22mventeenth\n \u001b[1me\u001b[22mighteenth\n nin\u001b[1me\u001b[22mteenth\n tw\u001b[1me\u001b[22mntieth\n tw\u001b[1me\u001b[22mnty-first\n tw\u001b[1me\u001b[22mnty-second\n tw\u001b[1me\u001b[22mnty-third\n tw\u001b[1me\u001b[22mnty-fourth\n tw\u001b[1me\u001b[22mnty-fifth\n tw\u001b[1me\u001b[22mnty-sixth\n tw\u001b[1me\u001b[22mnty-seventh\n tw\u001b[1me\u001b[22mnty-eighth\n tw\u001b[1me\u001b[22mnty-ninth\n thirti\u001b[1me\u001b[22mth\n thirty-s\u001b[1me\u001b[22mcond\n\n \u001b[2mPress ↑↓ arrows to select, enter to confirm\u001b[22m\n \"\n `)\n\n await sendInputAndWaitForChange(renderInstance, ENTER)\n\n expect(getLastFrameAfterUnmount(renderInstance)).toMatchInlineSnapshot(`\n \"? Associate your project with the org Castile Ventures?\n \u001b[36m✔\u001b[39m \u001b[36msecond\u001b[39m\n \"\n `)\n\n expect(onEnter).toHaveBeenCalledWith('second')\n })\n\n test('displays an error message if the search fails', async () => {\n const search = (_term: string) => {\n return Promise.reject(new Error('Something went wrong'))\n }\n\n const renderInstance = render(\n <AutocompletePrompt\n message=\"Associate your project with the org Castile Ventures?\"\n choices={DATABASE}\n onSubmit={() => {}}\n search={search}\n />,\n )\n\n await waitForInputsToBeReady()\n await sendInputAndWaitForContent(renderInstance, 'There has been an error', 'i')\n\n expect(renderInstance.lastFrame()).toMatchInlineSnapshot(`\n \"? Associate your project with the org Castile Ventures? \u001b[36mi\u001b[7m \u001b[27m\u001b[39m\n\n \u001b[31mThere has been an error while searching. Please try again later.\u001b[39m\n \"\n `)\n })\n\n test('immediately shows the initial items if the search is empty', async () => {\n const search = (term: string) => {\n return Promise.resolve(DATABASE.filter((item) => item.label.includes(term)))\n }\n\n const renderInstance = render(\n <AutocompletePrompt\n message=\"Associate your project with the org Castile Ventures?\"\n choices={DATABASE}\n onSubmit={() => {}}\n search={search}\n />,\n )\n\n await waitForInputsToBeReady()\n await sendInputAndWaitForContent(renderInstance, 'th\u001b[1mi\u001b[22mrty-sixth', 'i')\n\n expect(renderInstance.lastFrame()).toMatchInlineSnapshot(`\n \"? Associate your project with the org Castile Ventures? \u001b[36mi\u001b[7m \u001b[27m\u001b[39m\n\n \u001b[36m>\u001b[39m \u001b[36mf\u001b[1mi\u001b[22mrst\u001b[39m\n th\u001b[1mi\u001b[22mrd\n f\u001b[1mi\u001b[22mfth\n s\u001b[1mi\u001b[22mxth\n e\u001b[1mi\u001b[22mghth\n n\u001b[1mi\u001b[22mnth\n th\u001b[1mi\u001b[22mrteenth\n f\u001b[1mi\u001b[22mfteenth\n s\u001b[1mi\u001b[22mxteenth\n e\u001b[1mi\u001b[22mghteenth\n n\u001b[1mi\u001b[22mneteenth\n twent\u001b[1mi\u001b[22meth\n twenty-f\u001b[1mi\u001b[22mrst\n twenty-th\u001b[1mi\u001b[22mrd\n twenty-f\u001b[1mi\u001b[22mfth\n twenty-s\u001b[1mi\u001b[22mxth\n twenty-e\u001b[1mi\u001b[22mghth\n twenty-n\u001b[1mi\u001b[22mnth\n th\u001b[1mi\u001b[22mrtieth\n th\u001b[1mi\u001b[22mrty-first\n th\u001b[1mi\u001b[22mrty-second\n th\u001b[1mi\u001b[22mrty-third\n th\u001b[1mi\u001b[22mrty-fourth\n th\u001b[1mi\u001b[22mrty-fifth\n th\u001b[1mi\u001b[22mrty-sixth\n\n \u001b[2mPress ↑↓ arrows to select, enter to confirm\u001b[22m\n \"\n `)\n\n await sendInputAndWaitForChange(renderInstance, DELETE)\n\n expect(renderInstance.lastFrame()).toMatchInlineSnapshot(`\n \"? Associate your project with the org Castile Ventures? \u001b[36m\u001b[7mT\u001b[27m\u001b[2mype to search...\u001b[22m\u001b[39m\n\n \u001b[36m>\u001b[39m \u001b[36mfirst\u001b[39m\n second\n third\n fourth\n fifth\n sixth\n seventh\n eighth\n ninth\n tenth\n eleventh\n twelfth\n thirteenth\n fourteenth\n fifteenth\n sixteenth\n seventeenth\n eighteenth\n nineteenth\n twentieth\n twenty-first\n twenty-second\n twenty-third\n twenty-fourth\n twenty-fifth\n\n \u001b[2mPress ↑↓ arrows to select, enter to confirm\u001b[22m\n \"\n `)\n })\n})\n"]}
|
|
@@ -10,16 +10,16 @@ function typeToColor(type) {
|
|
|
10
10
|
external_error: 'red',
|
|
11
11
|
}[type];
|
|
12
12
|
}
|
|
13
|
-
const BoxWithBorder = ({ type,
|
|
13
|
+
const BoxWithBorder = ({ type, children }) => {
|
|
14
14
|
const { twoThirds } = useLayout();
|
|
15
|
-
return (React.createElement(Box, { width: twoThirds, paddingY: 1, paddingX: 2,
|
|
15
|
+
return (React.createElement(Box, { width: twoThirds, paddingY: 1, paddingX: 2, marginBottom: 1, borderStyle: "round", flexDirection: "column", borderColor: typeToColor(type) },
|
|
16
16
|
React.createElement(Box, { marginTop: -2, marginBottom: 1, marginLeft: -1 },
|
|
17
17
|
React.createElement(Text, null, ` ${type.replace(/_/g, ' ')} `)),
|
|
18
18
|
children));
|
|
19
19
|
};
|
|
20
|
-
const BoxWithTopBottomLines = ({ type,
|
|
20
|
+
const BoxWithTopBottomLines = ({ type, children }) => {
|
|
21
21
|
const { twoThirds } = useLayout();
|
|
22
|
-
return (React.createElement(Box, {
|
|
22
|
+
return (React.createElement(Box, { flexDirection: "column", marginBottom: 1 },
|
|
23
23
|
React.createElement(Box, { marginBottom: 1 },
|
|
24
24
|
React.createElement(Text, null,
|
|
25
25
|
React.createElement(Text, { color: typeToColor(type) }, '─'.repeat(2)),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Banner.js","sourceRoot":"","sources":["../../../../../src/private/node/ui/components/Banner.tsx"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,wBAAwB,CAAA;AAC9C,OAAO,EAAC,GAAG,EAAE,IAAI,EAAC,MAAM,KAAK,CAAA;AAC7B,OAAO,KAAK,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"Banner.js","sourceRoot":"","sources":["../../../../../src/private/node/ui/components/Banner.tsx"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,wBAAwB,CAAA;AAC9C,OAAO,EAAC,GAAG,EAAE,IAAI,EAAC,MAAM,KAAK,CAAA;AAC7B,OAAO,KAAK,MAAM,OAAO,CAAA;AAQzB,SAAS,WAAW,CAAC,IAAmB;IACtC,OAAO;QACL,OAAO,EAAE,OAAO;QAChB,KAAK,EAAE,KAAK;QACZ,OAAO,EAAE,QAAQ;QACjB,IAAI,EAAE,KAAK;QACX,cAAc,EAAE,KAAK;KACtB,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AC,MAAM,GAAG,CAAC,CAAC,CAAQ,CAC/E,CACH;QAEL,QAAQ;QAET,oBAAC,GAAG,IAAC,SAAS,EAAE,CAAC;YACf,oBAAC,IAAI,IAAC,KAAK,EAAE,WAAW,CAAC,IAAI,CAAC,IAAG,GAAG,CAAC,MAAM,CAAC,SAAS,CAAC,CAAQ,CAC1D,CACF,CACP,CAAA;AACH,CAAC,CAAA;AAED,MAAM,MAAM,GAAoB,CAAC,EAAC,QAAQ,EAAE,GAAG,KAAK,EAAC,EAAE,EAAE;IACvD,IAAI,KAAK,CAAC,IAAI,KAAK,gBAAgB,EAAE;QACnC,OAAO,KAAK,CAAC,aAAa,CAAC,qBAAqB,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAA;KACnE;SAAM;QACL,OAAO,KAAK,CAAC,aAAa,CAAC,aAAa,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAA;KAC3D;AACH,CAAC,CAAA;AAED,OAAO,EAAC,MAAM,EAAC,CAAA","sourcesContent":["import useLayout from '../hooks/use-layout.js'\nimport {Box, Text} from 'ink'\nimport React from 'react'\n\nexport type BannerType = 'success' | 'error' | 'warning' | 'info' | 'external_error'\n\ninterface Props {\n type: BannerType\n}\n\nfunction typeToColor(type: Props['type']) {\n return {\n success: 'green',\n error: 'red',\n warning: 'yellow',\n info: 'dim',\n external_error: 'red',\n }[type]\n}\n\nconst BoxWithBorder: React.FC<Props> = ({type, children}) => {\n const {twoThirds} = useLayout()\n\n return (\n <Box\n width={twoThirds}\n paddingY={1}\n paddingX={2}\n marginBottom={1}\n borderStyle=\"round\"\n flexDirection=\"column\"\n borderColor={typeToColor(type)}\n >\n <Box marginTop={-2} marginBottom={1} marginLeft={-1}>\n <Text>{` ${type.replace(/_/g, ' ')} `}</Text>\n </Box>\n {children}\n </Box>\n )\n}\n\nconst BoxWithTopBottomLines: React.FC<Props> = ({type, children}) => {\n const {twoThirds} = useLayout()\n\n return (\n <Box flexDirection=\"column\" marginBottom={1}>\n <Box marginBottom={1}>\n <Text>\n <Text color={typeToColor(type)}>{'─'.repeat(2)}</Text>\n <Text>{` ${type.replace(/_/g, ' ')} `}</Text>\n {/* 2 initial dashes + 2 spaces surrounding the type */}\n <Text color={typeToColor(type)}>{'─'.repeat(twoThirds - 2 - type.length - 2)}</Text>\n </Text>\n </Box>\n\n {children}\n\n <Box marginTop={1}>\n <Text color={typeToColor(type)}>{'─'.repeat(twoThirds)}</Text>\n </Box>\n </Box>\n )\n}\n\nconst Banner: React.FC<Props> = ({children, ...props}) => {\n if (props.type === 'external_error') {\n return React.createElement(BoxWithTopBottomLines, props, children)\n } else {\n return React.createElement(BoxWithBorder, props, children)\n }\n}\n\nexport {Banner}\n"]}
|
|
@@ -9,7 +9,8 @@ describe('Banner', async () => {
|
|
|
9
9
|
"[32m╭─[39m success [32m────────────────────────────────────────────────────────────────────╮[39m
|
|
10
10
|
[32m│[39m [32m│[39m
|
|
11
11
|
[32m│[39m [32m│[39m
|
|
12
|
-
[32m╰──────────────────────────────────────────────────────────────────────────────╯[39m
|
|
12
|
+
[32m╰──────────────────────────────────────────────────────────────────────────────╯[39m
|
|
13
|
+
"
|
|
13
14
|
`);
|
|
14
15
|
});
|
|
15
16
|
test('renders with a border for info', async () => {
|
|
@@ -18,7 +19,8 @@ describe('Banner', async () => {
|
|
|
18
19
|
"[2m╭─[22m info [2m───────────────────────────────────────────────────────────────────────╮[22m
|
|
19
20
|
[2m│[22m [2m│[22m
|
|
20
21
|
[2m│[22m [2m│[22m
|
|
21
|
-
[2m╰──────────────────────────────────────────────────────────────────────────────╯[22m
|
|
22
|
+
[2m╰──────────────────────────────────────────────────────────────────────────────╯[22m
|
|
23
|
+
"
|
|
22
24
|
`);
|
|
23
25
|
});
|
|
24
26
|
test('renders with a border for warning', async () => {
|
|
@@ -27,7 +29,8 @@ describe('Banner', async () => {
|
|
|
27
29
|
"[33m╭─[39m warning [33m────────────────────────────────────────────────────────────────────╮[39m
|
|
28
30
|
[33m│[39m [33m│[39m
|
|
29
31
|
[33m│[39m [33m│[39m
|
|
30
|
-
[33m╰──────────────────────────────────────────────────────────────────────────────╯[39m
|
|
32
|
+
[33m╰──────────────────────────────────────────────────────────────────────────────╯[39m
|
|
33
|
+
"
|
|
31
34
|
`);
|
|
32
35
|
});
|
|
33
36
|
test('renders with a border for error', async () => {
|
|
@@ -36,7 +39,8 @@ describe('Banner', async () => {
|
|
|
36
39
|
"[31m╭─[39m error [31m──────────────────────────────────────────────────────────────────────╮[39m
|
|
37
40
|
[31m│[39m [31m│[39m
|
|
38
41
|
[31m│[39m [31m│[39m
|
|
39
|
-
[31m╰──────────────────────────────────────────────────────────────────────────────╯[39m
|
|
42
|
+
[31m╰──────────────────────────────────────────────────────────────────────────────╯[39m
|
|
43
|
+
"
|
|
40
44
|
`);
|
|
41
45
|
});
|
|
42
46
|
test('renders with a top and bottom lines only for external errors', async () => {
|
|
@@ -45,7 +49,8 @@ describe('Banner', async () => {
|
|
|
45
49
|
"[31m──[39m external error [31m──────────────────────────────────────────────────────────────[39m
|
|
46
50
|
|
|
47
51
|
|
|
48
|
-
[31m────────────────────────────────────────────────────────────────────────────────[39m
|
|
52
|
+
[31m────────────────────────────────────────────────────────────────────────────────[39m
|
|
53
|
+
"
|
|
49
54
|
`);
|
|
50
55
|
});
|
|
51
56
|
});
|