@rawcmd/core
Version:
Rawcmd core package.
30 lines (25 loc) • 735 B
text/typescript
import { Spec } from '@hayspec/spec';
import { EOL, Command, Typewriter, MemoryStreamlet } from '../../../src';
const spec = new Spec<{
streamlet: MemoryStreamlet;
typewriter: Typewriter;
command: Command;
}>();
spec.beforeEach((ctx) => {
ctx.set('streamlet', new MemoryStreamlet());
ctx.set('typewriter', new Typewriter({
streamlet: ctx.get('streamlet'),
}));
ctx.set('command', new Command({}, {
typewriter: ctx.get('typewriter'),
}));
});
spec.test('writes EOL character', async (ctx) => {
const streamlet = ctx.get('streamlet');
const command = ctx.get('command');
command.break();
command.write('a');
command.break();
ctx.is(streamlet.toString(), `${EOL}a${EOL}`);
});
export default spec;