aboutsummaryrefslogtreecommitdiff
path: root/node_modules/structured-clone/test/test.js
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2019-03-27 21:01:33 +0100
committerFlorian Dold <florian.dold@gmail.com>2019-03-27 21:01:33 +0100
commitcc97a4dd2a967e1c2273bd5f4c5f49a5bf2e2585 (patch)
tree92c5d88706a6ffc654d1b133618d357890e7096b /node_modules/structured-clone/test/test.js
parent3771b4d6b67b34c130f3a9a1a15f42deefdb2eda (diff)
remove node_modules
Diffstat (limited to 'node_modules/structured-clone/test/test.js')
-rw-r--r--node_modules/structured-clone/test/test.js100
1 files changed, 0 insertions, 100 deletions
diff --git a/node_modules/structured-clone/test/test.js b/node_modules/structured-clone/test/test.js
deleted file mode 100644
index 1a201e572..000000000
--- a/node_modules/structured-clone/test/test.js
+++ /dev/null
@@ -1,100 +0,0 @@
-var test = require('tape');
-
-test('deep cloning test', function (t) {
- t.plan(12)
-
- var clone = require('../')
-
- var a = { }
- a.b = a
- a.c = { $ref: '$' }
- a.d = new Buffer([0xde, 0xad])
- a.e = [ a, a.b ]
- a.f = new Date()
- a.g = /ab+a/i
-
- var a = clone(a);
-
- t.ok(a.b == a);
- t.ok(a.c.$ref == '$')
- t.ok(Buffer.isBuffer(a.d))
- t.ok(a.d[0] == 0xde)
- t.ok(a.d[1] == 0xad)
- t.ok(a.d.length == 2);
- t.ok(Array.isArray(a.e));
- t.ok(a.e.length == 2);
- t.ok(a.e[0] == a);
- t.ok(a.e[1] == a.b);
- t.ok(a.f instanceof Date);
- t.ok(a.g instanceof RegExp);
-})
-
-test('serializing test', function (t) {
- t.plan(14)
-
- var clone = require('../')
-
- var a = { }
- a.b = a
- a.c = { $ref: '$' }
- a.d = new Buffer([0xde, 0xad])
- a.e = [ a, a.b ]
- a.f = new Date()
- a.g = /ab+a/i
-
- var buf = clone.serialize(a);
- t.ok(buf.length, 'Buffer has length')
- t.ok(Buffer.isBuffer(buf), 'Buffer has length')
-
- var a = clone.deserialize(buf);
-
- t.ok(a.b == a);
- t.ok(a.c.$ref == '$')
- t.ok(Buffer.isBuffer(a.d))
- t.ok(a.d[0] == 0xde)
- t.ok(a.d[1] == 0xad)
- t.ok(a.d.length == 2);
- t.ok(Array.isArray(a.e));
- t.ok(a.e.length == 2);
- t.ok(a.e[0] == a);
- t.ok(a.e[1] == a.b);
- t.ok(a.f instanceof Date);
- t.ok(a.g instanceof RegExp);
-})
-
-test('deep copy root object', function (t) {
- t.plan(3);
-
- var clone = require('../');
-
- var buf = clone(new Buffer([0xca, 0xfe, 0xba, 0xbe]));
- t.ok(Buffer.isBuffer(buf));
- t.ok(buf.length == 4);
- t.ok(buf.readUInt32BE(0) == 0xcafebabe);
-});
-
-test('serializing root object', function (t) {
- t.plan(3);
-
- var clone = require('../');
-
- var buf = clone.deserialize(clone.serialize(new Buffer([0xca, 0xfe, 0xba, 0xbe])));
- t.ok(Buffer.isBuffer(buf));
- t.ok(buf.length == 4);
- t.ok(buf.readUInt32BE(0) == 0xcafebabe);
-});
-
-
-test('errors', function (t) {
- t.plan(4);
-
- var clone = require('../');
-
- var err = clone(new Error('boo!'));
- t.ok(err instanceof Error);
- t.ok(err.message == 'boo!');
-
- var err = clone.deserialize(clone.serialize(new Error('boo!')));
- t.ok(err instanceof Error);
- t.ok(err.message == 'boo!');
-}); \ No newline at end of file