Skip to content

Commit

Permalink
[fixed] injectParams invariant should not throw on values that coerce…
Browse files Browse the repository at this point in the history
… to false.
  • Loading branch information
nhunzaker committed Jun 28, 2014
1 parent dde5f42 commit f3dcdd7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion modules/helpers/Path.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ var Path = {
var paramName = getParamName(pathSegment);

invariant(
params[paramName],
params[paramName] != null,
'Missing "' + paramName + '" parameter for path "' + pattern + '"'
);

Expand Down
4 changes: 4 additions & 0 deletions specs/Path.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,10 @@ describe('Path.injectParams', function () {
it('returns the correct path', function () {
expect(Path.injectParams(pattern, { id: 'abc' })).toEqual('comments/abc/edit');
});

it('returns the correct path when the value is 0', function () {
expect(Path.injectParams(pattern, { id: 0 })).toEqual('comments/0/edit');
});
});

describe('and some params have special URL encoding', function () {
Expand Down

0 comments on commit f3dcdd7

Please sign in to comment.