summaryrefslogtreecommitdiff
path: root/tests/node_compat/test/parallel/test-stream-readable-invalid-chunk.js
diff options
context:
space:
mode:
Diffstat (limited to 'tests/node_compat/test/parallel/test-stream-readable-invalid-chunk.js')
-rw-r--r--tests/node_compat/test/parallel/test-stream-readable-invalid-chunk.js41
1 files changed, 41 insertions, 0 deletions
diff --git a/tests/node_compat/test/parallel/test-stream-readable-invalid-chunk.js b/tests/node_compat/test/parallel/test-stream-readable-invalid-chunk.js
new file mode 100644
index 000000000..a40526389
--- /dev/null
+++ b/tests/node_compat/test/parallel/test-stream-readable-invalid-chunk.js
@@ -0,0 +1,41 @@
+// deno-fmt-ignore-file
+// deno-lint-ignore-file
+
+// Copyright Joyent and Node contributors. All rights reserved. MIT license.
+// Taken from Node 18.12.1
+// This file is automatically generated by `tools/node_compat/setup.ts`. Do not modify this file manually.
+
+'use strict';
+
+const common = require('../common');
+const stream = require('stream');
+
+function testPushArg(val) {
+ const readable = new stream.Readable({
+ read: () => {}
+ });
+ readable.on('error', common.expectsError({
+ code: 'ERR_INVALID_ARG_TYPE',
+ name: 'TypeError'
+ }));
+ readable.push(val);
+}
+
+testPushArg([]);
+testPushArg({});
+testPushArg(0);
+
+function testUnshiftArg(val) {
+ const readable = new stream.Readable({
+ read: () => {}
+ });
+ readable.on('error', common.expectsError({
+ code: 'ERR_INVALID_ARG_TYPE',
+ name: 'TypeError'
+ }));
+ readable.unshift(val);
+}
+
+testUnshiftArg([]);
+testUnshiftArg({});
+testUnshiftArg(0);