Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorBenjamin Gruenbaum <benjamingr@gmail.com>2022-02-03 15:30:27 +0300
committerGitHub <noreply@github.com>2022-02-03 15:30:27 +0300
commit9a8fa710209baf7a5df2d65aeaa7022b67fbe18e (patch)
treec17dcbdf5507fc2ffa8d8586e7e82b8a4eb87dce /test
parent06625ff0a6fa77990c576efc842b8c3a458329bd (diff)
buffer: fix atob/btoa no-arg case
PR-URL: https://github.com/nodejs/node/pull/41478 Fixes: https://github.com/nodejs/node/issues/41450 Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Filip Skokan <panva.ip@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com>
Diffstat (limited to 'test')
-rw-r--r--test/parallel/test-btoa-atob-global.js9
-rw-r--r--test/parallel/test-btoa-atob.js14
2 files changed, 14 insertions, 9 deletions
diff --git a/test/parallel/test-btoa-atob-global.js b/test/parallel/test-btoa-atob-global.js
deleted file mode 100644
index 06a6d3ed28f..00000000000
--- a/test/parallel/test-btoa-atob-global.js
+++ /dev/null
@@ -1,9 +0,0 @@
-'use strict';
-
-require('../common');
-
-const { strictEqual } = require('assert');
-const buffer = require('buffer');
-
-strictEqual(globalThis.atob, buffer.atob);
-strictEqual(globalThis.btoa, buffer.btoa);
diff --git a/test/parallel/test-btoa-atob.js b/test/parallel/test-btoa-atob.js
new file mode 100644
index 00000000000..162406dd9f6
--- /dev/null
+++ b/test/parallel/test-btoa-atob.js
@@ -0,0 +1,14 @@
+'use strict';
+
+require('../common');
+
+const { strictEqual, throws } = require('assert');
+const buffer = require('buffer');
+
+// Exported on the global object
+strictEqual(globalThis.atob, buffer.atob);
+strictEqual(globalThis.btoa, buffer.btoa);
+
+// Throws type error on no argument passed
+throws(() => buffer.atob(), /TypeError/);
+throws(() => buffer.btoa(), /TypeError/);