-
-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathtest.tsx
30 lines (25 loc) · 1.47 KB
/
test.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import process from 'node:process';
import React from 'react';
import test from 'ava';
import {Text} from 'ink';
import {render} from 'ink-testing-library';
import stripAnsi from 'strip-ansi';
import Gradient from './source/index.js';
test('render', t => {
process.env.FORCE_COLOR = 1;
const text = `
██╗ ██╗ ███╗ ██╗ ██╗ ██████╗ ██████╗ ██████╗ ███╗ ██╗ ███████╗
██║ ██║ ████╗ ██║ ██║ ██╔════╝ ██╔═══██╗ ██╔══██╗ ████╗ ██║ ██╔════╝
██║ ██║ ██╔██╗ ██║ ██║ ██║ ██║ ██║ ██████╔╝ ██╔██╗ ██║ ███████╗
██║ ██║ ██║╚██╗██║ ██║ ██║ ██║ ██║ ██╔══██╗ ██║╚██╗██║ ╚════██║
╚██████╔╝ ██║ ╚████║ ██║ ╚██████╗ ╚██████╔╝ ██║ ██║ ██║ ╚████║ ███████║
`.trim().split('\n').map(line => line.trimStart()).join('\n');
const {lastFrame} = render(
<Gradient name='rainbow'>
<Text>{text}</Text>
</Gradient>,
);
console.log(lastFrame());
t.snapshot(stripAnsi(lastFrame()));
delete process.env.FORCE_COLOR;
});