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

Commit efa61ab

Browse files
committed
add failing test for regression
1 parent 20f7ce2 commit efa61ab

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

test.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,3 +226,25 @@ test('do not transform functions', t => {
226226
t.is(typeof fn({}, target, source).foo, 'function');
227227
t.end();
228228
});
229+
230+
test('bug - reuses object in deep assignment', t => {
231+
const fixture = {
232+
foo: {
233+
bar: false
234+
}
235+
};
236+
237+
const run = x => {
238+
const opts = fn({}, fixture);
239+
240+
if (x === true) {
241+
opts.foo.bar = true;
242+
}
243+
244+
return opts.foo.bar;
245+
};
246+
247+
t.true(run(true));
248+
t.false(run());
249+
t.end();
250+
});

0 commit comments

Comments
 (0)