1
0
Fork 0
forked from svrjs/svrjs
This repository has been archived on 2024-11-10. You can view files and clone it, but cannot push or open issues or pull requests.
svrjs/node_modules/object-inspect/test/circular.js

17 lines
451 B
JavaScript
Raw Permalink Normal View History

2023-07-29 20:33:28 +02:00
var inspect = require('../');
var test = require('tape');
test('circular', function (t) {
t.plan(2);
var obj = { a: 1, b: [3, 4] };
obj.c = obj;
t.equal(inspect(obj), '{ a: 1, b: [ 3, 4 ], c: [Circular] }');
var double = {};
double.a = [double];
double.b = {};
double.b.inner = double.b;
double.b.obj = double;
t.equal(inspect(double), '{ a: [ [Circular] ], b: { inner: [Circular], obj: [Circular] } }');
});