aboutsummaryrefslogtreecommitdiff
path: root/integration/bunjs-only-snippets
diff options
context:
space:
mode:
authorGravatar Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> 2022-06-15 07:17:42 -0700
committerGravatar Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> 2022-06-15 07:17:42 -0700
commit56e88fb4dd06e07569ddc3861e2e8e21f71e45b8 (patch)
treea355df05ffd4665916c3eefb8370e154d1128f72 /integration/bunjs-only-snippets
parentd93f09331394148441d142930fea236a9fd73c5c (diff)
downloadbun-56e88fb4dd06e07569ddc3861e2e8e21f71e45b8.tar.gz
bun-56e88fb4dd06e07569ddc3861e2e8e21f71e45b8.tar.zst
bun-56e88fb4dd06e07569ddc3861e2e8e21f71e45b8.zip
direct streams mostly workjarred/direct
Diffstat (limited to 'integration/bunjs-only-snippets')
-rw-r--r--integration/bunjs-only-snippets/ffi.test.js1
-rw-r--r--integration/bunjs-only-snippets/streams.test.js27
2 files changed, 27 insertions, 1 deletions
diff --git a/integration/bunjs-only-snippets/ffi.test.js b/integration/bunjs-only-snippets/ffi.test.js
index 6698ae51b..b8d79887b 100644
--- a/integration/bunjs-only-snippets/ffi.test.js
+++ b/integration/bunjs-only-snippets/ffi.test.js
@@ -383,7 +383,6 @@ function ffiRunner(types) {
var bigArray = new BigUint64Array(8);
new Uint8Array(bigArray.buffer).fill(255);
var bigIntArray = new BigInt64Array(bigArray.buffer);
-
expect(identity_uint64_t(bigArray[0])).toBe(bigArray[0]);
expect(identity_uint64_t(bigArray[0] - BigInt(1))).toBe(
bigArray[0] - BigInt(1)
diff --git a/integration/bunjs-only-snippets/streams.test.js b/integration/bunjs-only-snippets/streams.test.js
index a3d4965ee..929f4a29b 100644
--- a/integration/bunjs-only-snippets/streams.test.js
+++ b/integration/bunjs-only-snippets/streams.test.js
@@ -22,15 +22,37 @@ it("exists globally", () => {
expect(typeof CountQueuingStrategy).toBe("function");
});
+it("ReadableStream (direct)", async () => {
+ var stream = new ReadableStream({
+ pull(controller) {
+ controller.write("hello");
+ controller.write("world");
+ controller.close();
+ },
+ cancel() {},
+ type: "direct",
+ });
+ console.log("hello");
+ const chunks = [];
+ const chunk = await stream.getReader().read();
+ console.log("it's me");
+ chunks.push(chunk.value);
+ expect(chunks[0].join("")).toBe(Buffer.from("helloworld").join(""));
+});
+
it("ReadableStream (bytes)", async () => {
+ console.trace();
+
var stream = new ReadableStream({
start(controller) {
+ console.log("there");
controller.enqueue(Buffer.from("abdefgh"));
},
pull(controller) {},
cancel() {},
type: "bytes",
});
+ console.log("here");
const chunks = [];
const chunk = await stream.getReader().read();
chunks.push(chunk.value);
@@ -38,6 +60,7 @@ it("ReadableStream (bytes)", async () => {
});
it("ReadableStream (default)", async () => {
+ console.trace();
var stream = new ReadableStream({
start(controller) {
controller.enqueue(Buffer.from("abdefgh"));
@@ -53,6 +76,7 @@ it("ReadableStream (default)", async () => {
});
it("readableStreamToArray", async () => {
+ console.trace();
var queue = [Buffer.from("abdefgh")];
var stream = new ReadableStream({
pull(controller) {
@@ -73,6 +97,7 @@ it("readableStreamToArray", async () => {
});
it("readableStreamToArrayBuffer (bytes)", async () => {
+ console.trace();
var queue = [Buffer.from("abdefgh")];
var stream = new ReadableStream({
pull(controller) {
@@ -109,6 +134,7 @@ it("readableStreamToArrayBuffer (default)", async () => {
});
it("ReadableStream for Blob", async () => {
+ console.trace();
var blob = new Blob(["abdefgh", "ijklmnop"]);
expect(await blob.text()).toBe("abdefghijklmnop");
var stream = blob.stream();
@@ -125,6 +151,7 @@ it("ReadableStream for Blob", async () => {
});
it("ReadableStream for File", async () => {
+ console.trace();
var blob = file(import.meta.dir + "/fetch.js.txt");
var stream = blob.stream(24);
const chunks = [];