Skip to content

Commit

Permalink
test(utils): add coverage to streamToBuffer (#237)
Browse files Browse the repository at this point in the history
  • Loading branch information
naorpeled authored Jun 3, 2023
1 parent 4322589 commit 73a6194
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion __tests__/utils.unit.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"use strict";

const utils = require("../lib/utils");
const { Readable } = require('stream');

/******************************************************************************/
/*** BEGIN TESTS ***/
Expand Down Expand Up @@ -489,5 +490,15 @@ describe("Utility Function Tests:", function () {

}); // end deepMerge tests


describe("streamToBuffer:", function () {
it("Should transform a given stream to a buffer", function () {
let stream = new Readable();
stream.push("test");
stream.push(null);
return utils.streamToBuffer(stream).then((buffer) => {
expect(Buffer.isBuffer(buffer)).toBe(true);
expect(buffer.toString()).toBe("test");
});
})
})
}); // end UTILITY tests

0 comments on commit 73a6194

Please sign in to comment.