aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorGravatar dave caruso <me@paperdave.net> 2023-09-07 07:45:00 -0700
committerGravatar GitHub <noreply@github.com> 2023-09-07 07:45:00 -0700
commit36e5a072a94805d5644081052391860e2b51f710 (patch)
tree861b4ddc665e28ba321dd5ded17c29371b3358c5 /test
parent57a06745a48093c25d0f4729ccea41a918d6427d (diff)
downloadbun-36e5a072a94805d5644081052391860e2b51f710.tar.gz
bun-36e5a072a94805d5644081052391860e2b51f710.tar.zst
bun-36e5a072a94805d5644081052391860e2b51f710.zip
revert (#4539)
* Revert "remove native events from streams" This reverts commit e063a47a53744a2bf5b1c2dd433698c9e37b75d6. * finish revert * remove accidental submodule * dfghj
Diffstat (limited to 'test')
-rw-r--r--test/js/node/child_process/child_process.test.ts2
-rw-r--r--test/js/node/fs/fs.test.ts6
-rw-r--r--test/js/node/stream/bufferlist.test.ts25
3 files changed, 18 insertions, 15 deletions
diff --git a/test/js/node/child_process/child_process.test.ts b/test/js/node/child_process/child_process.test.ts
index 8c54a11c5..baf422bc9 100644
--- a/test/js/node/child_process/child_process.test.ts
+++ b/test/js/node/child_process/child_process.test.ts
@@ -188,7 +188,7 @@ describe("spawn()", () => {
});
const result = await promise;
- expect(/Open bun's Discord server/.test(result)).toBe(true);
+ expect(/bun.sh\/docs/.test(result)).toBe(true);
});
it("should allow us to spawn in a shell", async () => {
diff --git a/test/js/node/fs/fs.test.ts b/test/js/node/fs/fs.test.ts
index 0578e0fc7..4cfe93dc9 100644
--- a/test/js/node/fs/fs.test.ts
+++ b/test/js/node/fs/fs.test.ts
@@ -2025,11 +2025,7 @@ it("BigIntStats", () => {
it("test syscall errno, issue#4198", () => {
const path = `${tmpdir()}/non-existent-${Date.now()}.txt`;
expect(() => openSync(path, "r")).toThrow("No such file or directory");
- if (process.platform == "darwin") {
- expect(() => readSync(2147483640, Buffer.alloc(0))).toThrow("Bad file descriptor");
- } else {
- expect(() => readSync(2147483640, Buffer.alloc(0))).toThrow("Bad file number");
- }
+ expect(() => readSync(2147483640, Buffer.alloc(0))).toThrow("Bad file descriptor");
expect(() => readlinkSync(path)).toThrow("No such file or directory");
expect(() => realpathSync(path)).toThrow("No such file or directory");
expect(() => readFileSync(path)).toThrow("No such file or directory");
diff --git a/test/js/node/stream/bufferlist.test.ts b/test/js/node/stream/bufferlist.test.ts
index b78911858..8ab147d7e 100644
--- a/test/js/node/stream/bufferlist.test.ts
+++ b/test/js/node/stream/bufferlist.test.ts
@@ -38,7 +38,9 @@ it("should fail on .concat() with invalid items", () => {
const list = new Readable().readableBuffer;
expect(list.length).toBe(0);
expect(list.push("foo")).toBeUndefined();
- list.concat(42);
+ expect(() => {
+ list.concat(42);
+ }).toThrow(TypeError);
});
it("should fail on .concat() buffer overflow", () => {
@@ -61,7 +63,7 @@ it("should work with .consume() on strings", () => {
// @ts-ignore
const list = new Readable().readableBuffer;
expect(list.length).toBe(0);
- expect(() => list.consume()).toThrow();
+ expect(list.consume(42, true)).toBe("");
expect(list.push("foo")).toBeUndefined();
expect(list.push("bar")).toBeUndefined();
expect(list.push("baz")).toBeUndefined();
@@ -80,7 +82,7 @@ it("should work with .consume() on buffers", () => {
// @ts-ignore
const list = new Readable().readableBuffer;
expect(list.length).toBe(0);
- expect(() => list.consume()).toThrow();
+ expect(list.consume(42, false)).toEqual(new Uint8Array());
expect(list.push(makeUint8Array("foo"))).toBeUndefined();
expect(list.push(makeUint8Array("bar"))).toBeUndefined();
expect(list.push(makeUint8Array("baz"))).toBeUndefined();
@@ -103,21 +105,26 @@ it("should fail on .consume() with invalid items", () => {
expect(list.length).toBe(0);
expect(list.push("foo")).toBeUndefined();
expect(list.length).toBe(1);
- expect(list.consume(0, false)).toEqual("");
- expect(list.consume(1, false)).toEqual("f");
- expect(list.consume(2, true)).toBe("oo");
+ expect(list.consume(0, false)).toEqual(new Uint8Array([]));
+ expect(() => {
+ list.consume(1, false);
+ }).toThrow(TypeError);
+ expect(list.consume(3, true)).toBe("foo");
expect(list.length).toBe(0);
expect(list.push(makeUint8Array("bar"))).toBeUndefined();
expect(list.length).toBe(1);
- expect(list.consume(0, true).byteLength).toEqual(0);
- expect(list.consume(1, true)[0]).toEqual(98);
+ expect(list.consume(0, true)).toEqual("");
+ expect(() => {
+ list.consume(1, true);
+ }).toThrow(TypeError);
+ expect(list.consume(3, false)).toEqual(new Uint8Array([98, 97, 114]));
});
it("should work with .first()", () => {
// @ts-ignore
const list = new Readable().readableBuffer;
expect(list.length).toBe(0);
- expect(() => list.first()).toThrow();
+ expect(list.first()).toBeUndefined();
const item = {};
expect(list.push(item)).toBeUndefined();
expect(list.length).toBe(1);