aboutsummaryrefslogtreecommitdiff
path: root/test/bun.js/streams.test.js
diff options
context:
space:
mode:
authorGravatar Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> 2022-11-25 00:08:36 -0800
committerGravatar Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> 2022-11-25 00:08:36 -0800
commitd1a4f4fd6981a06920adb632dde2562b76ddc4d0 (patch)
tree6a26cd3ebd8afdbad653a800d54967c4e84b55c2 /test/bun.js/streams.test.js
parent0b915fed034c38ae9a2e15caee94530910dc864b (diff)
downloadbun-d1a4f4fd6981a06920adb632dde2562b76ddc4d0.tar.gz
bun-d1a4f4fd6981a06920adb632dde2562b76ddc4d0.tar.zst
bun-d1a4f4fd6981a06920adb632dde2562b76ddc4d0.zip
Introduce `FileSink.ref()` and `FileSink.unref()`
Diffstat (limited to 'test/bun.js/streams.test.js')
-rw-r--r--test/bun.js/streams.test.js12
1 files changed, 6 insertions, 6 deletions
diff --git a/test/bun.js/streams.test.js b/test/bun.js/streams.test.js
index a872b7701..406c80852 100644
--- a/test/bun.js/streams.test.js
+++ b/test/bun.js/streams.test.js
@@ -225,7 +225,7 @@ it("Bun.file() read text from pipe", async () => {
const large = "HELLO!".repeat((((1024 * 65) / "HELLO!".length) | 0) + 1);
const chunks = [];
- var out = Bun.file("/tmp/fifo").stream();
+
const proc = Bun.spawn({
cmd: [
"bash",
@@ -244,17 +244,17 @@ it("Bun.file() read text from pipe", async () => {
const prom = (async function () {
while (chunks.length === 0) {
+ var out = Bun.file("/tmp/fifo").stream();
for await (const chunk of out) {
chunks.push(chunk);
}
- console.log("done");
}
+ return Buffer.concat(chunks).toString();
})();
const [status, output] = await Promise.all([exited, prom]);
- console.log("here");
- expect(output.length).toBe(large.length);
- expect(output).toBe(large);
+ expect(output.length).toBe(large.length + 1);
+ expect(output).toBe(large + "\n");
expect(status).toBe(0);
});
@@ -452,7 +452,7 @@ it("ReadableStream for Blob", async () => {
it("ReadableStream for File", async () => {
var blob = file(import.meta.dir + "/fetch.js.txt");
- var stream = blob.stream(24);
+ var stream = blob.stream();
const chunks = [];
var reader = stream.getReader();
stream = undefined;