Skip to content

Commit

Permalink
add unit test for pipe #606
Browse files Browse the repository at this point in the history
  • Loading branch information
jcubic committed Aug 1, 2020
1 parent b980048 commit c980206
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions __tests__/terminal.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2251,6 +2251,23 @@ describe('Terminal utils', function() {
}));
await term.exec('echo "|" | read');
expect(get_lines(term)).toEqual(['your text: |']);
term.destroy();
// new API with option that use monkey patch
term = $('<div/>').terminal({
read: function() {
return this.read('').then((text) => {
this.echo('your text: ' + text);
});
},
echo: async function(string) {
await delay(10);
return string;
}
}, {
pipe: true
});
await term.exec('echo "|" | read');
expect(get_lines(term)).toEqual(['your text: |']);
});
it('should filter lines', function() {
var term = $('<div/>').terminal($.terminal.pipe({
Expand Down

0 comments on commit c980206

Please sign in to comment.