-
-
Notifications
You must be signed in to change notification settings - Fork 31
/
test.js
38 lines (34 loc) · 879 Bytes
/
test.js
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
31
32
33
34
35
36
37
38
import fs from 'node:fs';
import delay from 'delay';
import test from 'ava';
import terminalImage from './index.js';
test('.buffer()', async t => {
const result = await terminalImage.buffer(fs.readFileSync('fixture.jpg'));
t.is(typeof result, 'string');
});
test('.file()', async t => {
const result = await terminalImage.file('fixture.jpg');
t.is(typeof result, 'string');
});
test('.gifBuffer()', async t => {
let result = '';
const stopAnimation = terminalImage.gifBuffer(fs.readFileSync('fixture.gif'), {
renderFrame(text) {
result += text;
},
});
await delay(500);
stopAnimation();
t.is(typeof result, 'string');
});
test('.gifFile()', async t => {
let result = '';
const stopAnimation = terminalImage.gifFile('fixture.gif', {
renderFrame(text) {
result += text;
},
});
await delay(500);
stopAnimation();
t.is(typeof result, 'string');
});