aboutsummaryrefslogtreecommitdiff
path: root/test/bun.js/node-stream.test.js
diff options
context:
space:
mode:
authorGravatar Ashcon Partovi <ashcon@partovi.net> 2023-03-07 12:22:34 -0800
committerGravatar GitHub <noreply@github.com> 2023-03-07 12:22:34 -0800
commitf7e4eb83694aa007a492ef66c28ffbe6a2dae791 (patch)
tree7af25aa5c42a2e1b2b47ba1df35f8caa9054cbeb /test/bun.js/node-stream.test.js
parent36275a44ce7a33587bd26aad120042ab95470ff3 (diff)
downloadbun-f7e4eb83694aa007a492ef66c28ffbe6a2dae791.tar.gz
bun-f7e4eb83694aa007a492ef66c28ffbe6a2dae791.tar.zst
bun-f7e4eb83694aa007a492ef66c28ffbe6a2dae791.zip
Reorganize tests (#2332)
Diffstat (limited to 'test/bun.js/node-stream.test.js')
-rw-r--r--test/bun.js/node-stream.test.js86
1 files changed, 0 insertions, 86 deletions
diff --git a/test/bun.js/node-stream.test.js b/test/bun.js/node-stream.test.js
deleted file mode 100644
index 6bff28b94..000000000
--- a/test/bun.js/node-stream.test.js
+++ /dev/null
@@ -1,86 +0,0 @@
-import { expect, describe, it } from "bun:test";
-import { Readable, Writable, Duplex, Transform, PassThrough } from "node:stream";
-
-describe("Readable", () => {
- it("should be able to be created without _construct method defined", done => {
- const readable = new Readable({
- read() {
- this.push("Hello World!\n");
- this.push(null);
- },
- });
- expect(readable instanceof Readable).toBe(true);
- let data = "";
- readable.on("data", chunk => {
- data += chunk.toString();
- });
- readable.on("end", () => {
- expect(data).toBe("Hello World!\n");
- done();
- });
- });
-
- it("should be able to be piped via .pipe", done => {
- const readable = new Readable({
- read() {
- this.push("Hello World!");
- this.push(null);
- },
- });
-
- const writable = new Writable({
- write(chunk, encoding, callback) {
- expect(chunk.toString()).toBe("Hello World!");
- callback();
- done();
- },
- });
-
- readable.pipe(writable);
- });
-});
-
-describe("Duplex", () => {
- it("should allow subclasses to be derived via .call() on class", () => {
- function Subclass(opts) {
- if (!(this instanceof Subclass)) return new Subclass(opts);
- Duplex.call(this, opts);
- }
-
- Object.setPrototypeOf(Subclass.prototype, Duplex.prototype);
- Object.setPrototypeOf(Subclass, Duplex);
-
- const subclass = new Subclass();
- expect(subclass instanceof Duplex).toBe(true);
- });
-});
-
-describe("Transform", () => {
- it("should allow subclasses to be derived via .call() on class", () => {
- function Subclass(opts) {
- if (!(this instanceof Subclass)) return new Subclass(opts);
- Transform.call(this, opts);
- }
-
- Object.setPrototypeOf(Subclass.prototype, Transform.prototype);
- Object.setPrototypeOf(Subclass, Transform);
-
- const subclass = new Subclass();
- expect(subclass instanceof Transform).toBe(true);
- });
-});
-
-describe("PassThrough", () => {
- it("should allow subclasses to be derived via .call() on class", () => {
- function Subclass(opts) {
- if (!(this instanceof Subclass)) return new Subclass(opts);
- PassThrough.call(this, opts);
- }
-
- Object.setPrototypeOf(Subclass.prototype, PassThrough.prototype);
- Object.setPrototypeOf(Subclass, PassThrough);
-
- const subclass = new Subclass();
- expect(subclass instanceof PassThrough).toBe(true);
- });
-});