Skip to content

Commit

Permalink
test stackRemaining and change link to wiki
Browse files Browse the repository at this point in the history
  • Loading branch information
shamrin committed Apr 14, 2016
1 parent 04f715c commit 57c25c2
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/seamless-immutable.js
Original file line number Diff line number Diff line change
Expand Up @@ -519,8 +519,8 @@
}
if (stackRemaining <= 0) {
throw new ImmutableError("Attempt to construct Immutable from a deeply nested object was detected." +
" Have you tried to wrap an object with circular references (e.g. React Component)?" +
" See https://github.com/rtfeldman/seamless-immutable/issues/73 for details.");
" Have you tried to wrap an object with circular references (e.g. React element)?" +
" See https://github.com/rtfeldman/seamless-immutable/wiki/Deeply-nested-object-was-detected for details.");
}
stackRemaining -= 1;
}
Expand Down
14 changes: 14 additions & 0 deletions test/Immutable.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,20 @@ var getTestUtils = require("./TestUtils.js");
assert.throws(function() { Immutable(obj); }, /deeply nested/);
}
});

it("can configure stackRemaining", function() {
var mutable = {bottom: true};
_.range(65).forEach(function() {
mutable = {prop: mutable};
});

if (config.id === 'prod') {
TestUtils.assertJsonEqual(mutable, Immutable(mutable));
} else {
assert.throws(function() { Immutable(mutable); }, /deeply nested/);
TestUtils.assertJsonEqual(mutable, Immutable(mutable, null, 66));
}
});
});
});
});

0 comments on commit 57c25c2

Please sign in to comment.