Skip to content

Commit ac731c5

Browse files
committed
More accurate comparison
1 parent 5a1ed33 commit ac731c5

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

modules/utils/__tests__/Path-test.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,12 +67,14 @@ describe('Path.extractParams', function () {
6767
expect(Path.extractParams(pattern, 'comments/123/edit')).toEqual({ id: '123' });
6868
});
6969
});
70+
7071
describe('and the path matches without supplied param', function () {
71-
it('returns an object with param set to null', function () {
72-
expect(Path.extractParams(pattern, 'comments//edit')).toEqual({id: null});
72+
it('returns an object with an undefined param', function () {
73+
expect(Path.extractParams(pattern, 'comments//edit')).toEqual({ id: undefined });
7374
});
7475
});
7576
});
77+
7678
describe('and the pattern and forward slash are optional', function () {
7779
var pattern = 'comments/:id?/?edit'
7880

@@ -81,12 +83,14 @@ describe('Path.extractParams', function () {
8183
expect(Path.extractParams(pattern, 'comments/123/edit')).toEqual({ id: '123' });
8284
});
8385
});
86+
8487
describe('and the path matches without supplied param', function () {
85-
it('returns an object with param set to null', function () {
86-
expect(Path.extractParams(pattern, 'comments/edit')).toEqual({id: null});
88+
it('returns an object with an undefined param', function () {
89+
expect(Path.extractParams(pattern, 'comments/edit')).toEqual({ id: undefined });
8790
});
8891
});
8992
});
93+
9094
describe('and the path does not match', function () {
9195
it('returns null', function () {
9296
expect(Path.extractParams(pattern, 'users/123')).toBe(null);

0 commit comments

Comments
 (0)