mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-09 02:17:50 +00:00
Avoid tests not relevant to modularized builds when its selected.
Former-commit-id: 3e0e4275cfa51fc12ea9583801459588658de702
This commit is contained in:
68
test/test.js
68
test/test.js
@@ -100,6 +100,9 @@
|
|||||||
'urlParams': {}
|
'urlParams': {}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/** Used to indicate testing a modularized build */
|
||||||
|
var isModularize = /modularize/.test(ui.urlParams.build);
|
||||||
|
|
||||||
/*--------------------------------------------------------------------------*/
|
/*--------------------------------------------------------------------------*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -133,8 +136,7 @@
|
|||||||
|
|
||||||
// add web worker
|
// add web worker
|
||||||
(function() {
|
(function() {
|
||||||
if (!Worker || /modularize/.test(ui.urlParams.build)) {
|
if (!Worker || isModularize) {
|
||||||
_._VERSION = _.VERSION;
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var worker = new Worker('./worker.js');
|
var worker = new Worker('./worker.js');
|
||||||
@@ -177,7 +179,7 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
asyncTest('supports loading ' + basename + ' in a web worker', function() {
|
asyncTest('supports loading ' + basename + ' in a web worker', function() {
|
||||||
if (Worker) {
|
if (Worker && !isModularize) {
|
||||||
var limit = 1000,
|
var limit = 1000,
|
||||||
start = new Date;
|
start = new Date;
|
||||||
|
|
||||||
@@ -1607,39 +1609,59 @@
|
|||||||
indexOf = _.indexOf;
|
indexOf = _.indexOf;
|
||||||
|
|
||||||
test('`_.contains` should work with a custom `_.indexOf` method', function() {
|
test('`_.contains` should work with a custom `_.indexOf` method', function() {
|
||||||
_.indexOf = custom;
|
if (!isModularize) {
|
||||||
ok(_.contains(array, new Foo));
|
_.indexOf = custom;
|
||||||
_.indexOf = indexOf;
|
ok(_.contains(array, new Foo));
|
||||||
|
_.indexOf = indexOf;
|
||||||
|
} else {
|
||||||
|
skipTest();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
test('`_.difference` should work with a custom `_.indexOf` method', function() {
|
test('`_.difference` should work with a custom `_.indexOf` method', function() {
|
||||||
_.indexOf = custom;
|
if (!isModularize) {
|
||||||
deepEqual(_.difference(array, [new Foo]), [1, 3]);
|
_.indexOf = custom;
|
||||||
_.indexOf = indexOf;
|
deepEqual(_.difference(array, [new Foo]), [1, 3]);
|
||||||
|
_.indexOf = indexOf;
|
||||||
|
} else {
|
||||||
|
skipTest();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
test('`_.intersection` should work with a custom `_.indexOf` method', function() {
|
test('`_.intersection` should work with a custom `_.indexOf` method', function() {
|
||||||
_.indexOf = custom;
|
if (!isModularize) {
|
||||||
deepEqual(_.intersection(array, [new Foo]), [array[1]]);
|
_.indexOf = custom;
|
||||||
_.indexOf = indexOf;
|
deepEqual(_.intersection(array, [new Foo]), [array[1]]);
|
||||||
|
_.indexOf = indexOf;
|
||||||
|
} else {
|
||||||
|
skipTest();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
test('`_.omit` should work with a custom `_.indexOf` method', function() {
|
test('`_.omit` should work with a custom `_.indexOf` method', function() {
|
||||||
_.indexOf = custom;
|
if (!isModularize) {
|
||||||
deepEqual(_.omit(array, ['x']), { '0': 1, '2': 3 });
|
_.indexOf = custom;
|
||||||
_.indexOf = indexOf;
|
deepEqual(_.omit(array, ['x']), { '0': 1, '2': 3 });
|
||||||
|
_.indexOf = indexOf;
|
||||||
|
} else {
|
||||||
|
skipTest();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
test('`_.uniq` should work with a custom `_.indexOf` method', function() {
|
test('`_.uniq` should work with a custom `_.indexOf` method', function() {
|
||||||
_.indexOf = custom;
|
if (!isModularize) {
|
||||||
deepEqual(_.uniq(array), array.slice(0, 3));
|
_.indexOf = custom;
|
||||||
|
deepEqual(_.uniq(array), array.slice(0, 3));
|
||||||
|
|
||||||
var largeArray = _.times(largeArraySize, function() {
|
var largeArray = _.times(largeArraySize, function() {
|
||||||
return new Foo;
|
return new Foo;
|
||||||
});
|
});
|
||||||
|
|
||||||
deepEqual(_.uniq(largeArray), [largeArray[0]]);
|
deepEqual(_.uniq(largeArray), [largeArray[0]]);
|
||||||
_.indexOf = indexOf;
|
_.indexOf = indexOf;
|
||||||
|
} else {
|
||||||
|
skipTest(2);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}());
|
}());
|
||||||
|
|
||||||
@@ -3753,7 +3775,7 @@
|
|||||||
|
|
||||||
test('should correctly consume it\'s output', function() {
|
test('should correctly consume it\'s output', function() {
|
||||||
var expected = [['moe', 'larry'], [30, 40]];
|
var expected = [['moe', 'larry'], [30, 40]];
|
||||||
deepEqual(_.unzip(_.zip(_.unzip(_.zip(expected)))), expected);
|
deepEqual(_.zip(_.zip(_.zip(_.zip(expected)))), expected);
|
||||||
});
|
});
|
||||||
}());
|
}());
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user