Skip to content

Commit 65d9723

Browse files
committed
refactor: replace color functions with styleText utility in limit-options and log tests
1 parent ec2eed9 commit 65d9723

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

packages/prompts/test/limit-options.test.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,14 @@ describe('limitOptions', () => {
265265
options.rowPadding = 6;
266266
// Available rows for options = 12 - 6 = 6
267267
const result = limitOptions(options);
268-
expect(result).toEqual(['Item 1', 'Item 2', 'Item 3', 'Item 4', 'Item 5', color.dim('...')]);
268+
expect(result).toEqual([
269+
'Item 1',
270+
'Item 2',
271+
'Item 3',
272+
'Item 4',
273+
'Item 5',
274+
styleText('dim', '...'),
275+
]);
269276
});
270277

271278
test('respects custom rowPadding when scrolling', async () => {
@@ -289,12 +296,12 @@ describe('limitOptions', () => {
289296
// Available rows for options = 12 - 6 = 6
290297
const result = limitOptions(options);
291298
expect(result).toEqual([
292-
color.dim('...'),
299+
styleText('dim', '...'),
293300
'Item 4',
294301
'Item 5',
295302
'Item 6',
296303
'Item 7',
297-
color.dim('...'),
304+
styleText('dim', '...'),
298305
]);
299306
});
300307
});

packages/prompts/test/log.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import colors from 'picocolors';
1+
import { styleText } from 'node:util';
22
import { afterAll, afterEach, beforeAll, beforeEach, describe, expect, test, vi } from 'vitest';
33
import * as prompts from '../src/index.js';
44
import { MockWritable } from './test-utils.js';
@@ -51,8 +51,8 @@ describe.each(['true', 'false'])('log (isCI = %s)', (isCI) => {
5151

5252
test('renders message with custom symbols and spacing', () => {
5353
prompts.log.message('custom\nsymbols', {
54-
symbol: colors.red('>>'),
55-
secondarySymbol: colors.yellow('--'),
54+
symbol: styleText('red', '>>'),
55+
secondarySymbol: styleText('yellow', '--'),
5656
output,
5757
});
5858

0 commit comments

Comments
 (0)