Skip to content
This repository has been archived by the owner on Jan 23, 2021. It is now read-only.

Commit

Permalink
add failing test for regression
Browse files Browse the repository at this point in the history
  • Loading branch information
sindresorhus committed Oct 29, 2015
1 parent 20f7ce2 commit efa61ab
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions test.js
Original file line number Diff line number Diff line change
Expand Up @@ -226,3 +226,25 @@ test('do not transform functions', t => {
t.is(typeof fn({}, target, source).foo, 'function');
t.end();
});

test('bug - reuses object in deep assignment', t => {
const fixture = {
foo: {
bar: false
}
};

const run = x => {
const opts = fn({}, fixture);

if (x === true) {
opts.foo.bar = true;
}

return opts.foo.bar;
};

t.true(run(true));
t.false(run());
t.end();
});

0 comments on commit efa61ab

Please sign in to comment.