Files
pjax/tests/lib/util/clone.js

22 lines
481 B
JavaScript
Raw Permalink Normal View History

2019-03-03 01:37:45 -05:00
var tape = require("tape");
2019-03-03 01:37:45 -05:00
var clone = require("../../../lib/util/clone");
tape("test clone method", function(t) {
2019-03-03 01:37:45 -05:00
var obj = { one: 1, two: 2 };
var cloned = clone(obj);
2019-03-03 01:37:45 -05:00
t.notEqual(obj, cloned, "cloned object isn't the original object");
2019-03-03 01:37:45 -05:00
t.same(obj, cloned, "cloned object has the same values as original object");
2019-03-03 01:37:45 -05:00
cloned.three = 3;
t.notSame(
obj,
cloned,
"modified cloned object doesn't have the same values as original object"
);
2019-03-03 01:37:45 -05:00
t.end();
});