|
1 | 1 | "use strict"; |
2 | 2 |
|
3 | 3 | const utils = require("../lib/utils"); |
| 4 | +const { Readable } = require('stream'); |
4 | 5 |
|
5 | 6 | /******************************************************************************/ |
6 | 7 | /*** BEGIN TESTS ***/ |
@@ -489,5 +490,15 @@ describe("Utility Function Tests:", function () { |
489 | 490 |
|
490 | 491 | }); // end deepMerge tests |
491 | 492 |
|
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 | + }) |
493 | 504 | }); // end UTILITY tests |
0 commit comments