You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
17 lines
398 B
17 lines
398 B
import test from 'ava';
|
|
import fn from './';
|
|
|
|
test.serial('get stdin', async t => {
|
|
t.plan(1);
|
|
process.stdin.isTTY = false;
|
|
const promise = fn();
|
|
process.stdin.push('uni');
|
|
process.stdin.push('corns');
|
|
process.stdin.emit('end');
|
|
t.is((await promise).trim(), 'unicorns');
|
|
});
|
|
|
|
test.serial('get empty string when no stdin', async t => {
|
|
process.stdin.isTTY = true;
|
|
t.is(await fn(), '');
|
|
});
|
|
|