Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 73a6194

Browse files
test(utils): add coverage to streamToBuffer (#237)
1 parent 4322589 commit 73a6194

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

‎__tests__/utils.unit.js‎

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"use strict";
22

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

56
/******************************************************************************/
67
/*** BEGIN TESTS ***/
@@ -489,5 +490,15 @@ describe("Utility Function Tests:", function () {
489490

490491
}); // end deepMerge tests
491492

492-
493+
describe("streamToBuffer:", function () {
494+
it("Should transform a given stream to a buffer", function () {
495+
let stream = new Readable();
496+
stream.push("test");
497+
stream.push(null);
498+
return utils.streamToBuffer(stream).then((buffer) => {
499+
expect(Buffer.isBuffer(buffer)).toBe(true);
500+
expect(buffer.toString()).toBe("test");
501+
});
502+
})
503+
})
493504
}); // end UTILITY tests

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /