-
Notifications
You must be signed in to change notification settings - Fork 27.5k
feat(limitTo): ignore limit when undefined #10510
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,20 +34,30 @@ describe('Filter: limitTo', function() { | |
}); | ||
|
||
|
||
it('should return an empty array when X cannot be parsed', function() { | ||
expect(limitTo(items, 'bogus')).toEqual([]); | ||
expect(limitTo(items, 'null')).toEqual([]); | ||
expect(limitTo(items, 'undefined')).toEqual([]); | ||
expect(limitTo(items, null)).toEqual([]); | ||
expect(limitTo(items, undefined)).toEqual([]); | ||
it('should return an empty array when X = 0', function() { | ||
expect(limitTo(items, 0)).toEqual([]); | ||
expect(limitTo(items, '0')).toEqual([]); | ||
}); | ||
|
||
it('should return an empty string when X cannot be parsed', function() { | ||
expect(limitTo(str, 'bogus')).toEqual(""); | ||
expect(limitTo(str, 'null')).toEqual(""); | ||
expect(limitTo(str, 'undefined')).toEqual(""); | ||
expect(limitTo(str, null)).toEqual(""); | ||
expect(limitTo(str, undefined)).toEqual(""); | ||
it('should return entire array when X cannot be parsed', function() { | ||
expect(limitTo(items, 'bogus')).toEqual(items); | ||
expect(limitTo(items, 'null')).toEqual(items); | ||
expect(limitTo(items, 'undefined')).toEqual(items); | ||
expect(limitTo(items, null)).toEqual(items); | ||
expect(limitTo(items, undefined)).toEqual(items); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There should also be a test with UPDATE: Has been added. |
||
}); | ||
|
||
it('should return an empty string when X = 0', function() { | ||
expect(limitTo(str, 0)).toEqual(""); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit picking: Could add a test for There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added |
||
expect(limitTo(str, '0')).toEqual(""); | ||
}); | ||
|
||
it('should return entire string when X cannot be parsed', function() { | ||
expect(limitTo(str, 'bogus')).toEqual(str); | ||
expect(limitTo(str, 'null')).toEqual(str); | ||
expect(limitTo(str, 'undefined')).toEqual(str); | ||
expect(limitTo(str, null)).toEqual(str); | ||
expect(limitTo(str, undefined)).toEqual(str); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There should also be a test with UPDATE: Has been added. |
||
}); | ||
|
||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit picking: Could add a test for
'0'
(string) as well.