Skip to content

Commit

Permalink
Add regression tests for #269
Browse files Browse the repository at this point in the history
  • Loading branch information
RReverser committed Aug 13, 2018
1 parent c63bfe8 commit 8e671ad
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -263,3 +263,10 @@ exports['Regression - RewritingStream - Last text chunk must be flushed (GH-271)
parser.write('text');
parser.end();
};

exports['Regression - RewritingStream - Should not accept binary input (GH-269)'] = () => {
const stream = new RewritingStream();
const buf = Buffer.from('test');

assert.throws(() => stream.write(buf), TypeError);
};
7 changes: 7 additions & 0 deletions packages/parse5-parser-stream/test/parser-stream.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,10 @@ exports['Regression - Fix empty stream parsing with ParserStream (GH-196)'] = fu

parser.end();
};

exports['Regression - ParserStream - Should not accept binary input (GH-269)'] = () => {
const stream = new ParserStream();
const buf = Buffer.from('test');

assert.throws(() => stream.write(buf), TypeError);
};
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,10 @@ generateTestsForEachTreeAdapter(module.exports, (_test, treeAdapter) => {
);
};
});

exports['Regression - Plain text conversion stream - Should not accept binary input (GH-269)'] = () => {
const stream = new PlainTextConversionStream();
const buf = Buffer.from('test');

assert.throws(() => stream.write(buf), TypeError);
};
7 changes: 7 additions & 0 deletions packages/parse5-sax-parser/test/sax-parser.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,3 +142,10 @@ exports['Regression - SAX - Last text chunk must be flushed (GH-271)'] = done =>
parser.write('text');
parser.end();
};

exports['Regression - SAX - Should not accept binary input (GH-269)'] = () => {
const stream = new SAXParser();
const buf = Buffer.from('test');

assert.throws(() => stream.write(buf), TypeError);
};

0 comments on commit 8e671ad

Please sign in to comment.