mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-09 10:27:49 +00:00
Add back _.includes test for strings with a fromIndex.
This commit is contained in:
22
test/test.js
22
test/test.js
@@ -7690,6 +7690,28 @@
|
|||||||
assert.deepEqual(actual, expected);
|
assert.deepEqual(actual, expected);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
QUnit.test('should work with a string and a `fromIndex` >= `string.length`', function(assert) {
|
||||||
|
assert.expect(1);
|
||||||
|
|
||||||
|
var string = '1234',
|
||||||
|
length = string.length,
|
||||||
|
indexes = [4, 6, Math.pow(2, 32), Infinity];
|
||||||
|
|
||||||
|
var expected = lodashStable.map(indexes, function(index) {
|
||||||
|
return [false, false, index == length];
|
||||||
|
});
|
||||||
|
|
||||||
|
var actual = lodashStable.map(indexes, function(fromIndex) {
|
||||||
|
return [
|
||||||
|
_.includes(string, 1, fromIndex),
|
||||||
|
_.includes(string, undefined, fromIndex),
|
||||||
|
_.includes(string, '', fromIndex)
|
||||||
|
];
|
||||||
|
});
|
||||||
|
|
||||||
|
assert.deepEqual(actual, expected);
|
||||||
|
});
|
||||||
|
|
||||||
QUnit.test('should match `NaN`', function(assert) {
|
QUnit.test('should match `NaN`', function(assert) {
|
||||||
assert.expect(1);
|
assert.expect(1);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user