This repository has been archived on 2023-10-27. You can view files and clone it, but cannot push or open issues or pull requests.
current-kwh-cost/node_modules/object-inspect/test/circular.js
2022-11-17 16:42:35 +00:00

17 lines
451 B
JavaScript

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] } }');
});