Skip to content

Commit

Permalink
fixing the uncompress test
Browse files Browse the repository at this point in the history
  • Loading branch information
g11tech committed Apr 27, 2022
1 parent 2d98f69 commit 105300e
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,12 @@ describe("snappy frames uncompress", function () {
const decompress = new SnappyFramesUncompress();

const testData = Buffer.alloc(100000, 4).toString();
let result = Buffer.alloc(0);

compressStream.on("data", function (data) {
const result = decompress.uncompress(data);
if (result) {
// testData will come compressed as two or more chunks
result = Buffer.concat([result, decompress.uncompress(data) ?? Buffer.alloc(0)]);
if (result.length === testData.length) {
expect(result.toString()).to.be.equal(testData);
done();
}
Expand Down

0 comments on commit 105300e

Please sign in to comment.