mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-07 18:07:49 +00:00
Ajust tests for npm build modifications.
This commit is contained in:
53
test/test.js
53
test/test.js
@@ -788,24 +788,34 @@
|
|||||||
expected = _.map(values, _.constant(true));
|
expected = _.map(values, _.constant(true));
|
||||||
|
|
||||||
test('creates a new instance when called without the `new` operator', 1, function() {
|
test('creates a new instance when called without the `new` operator', 1, function() {
|
||||||
var actual = _.map(values, function(value) {
|
if (!isNpm) {
|
||||||
return _(value) instanceof _;
|
var actual = _.map(values, function(value) {
|
||||||
});
|
return _(value) instanceof _;
|
||||||
|
});
|
||||||
|
|
||||||
deepEqual(actual, expected);
|
deepEqual(actual, expected);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
skipTest();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
test('should return provided `lodash` instances', 1, function() {
|
test('should return provided `lodash` instances', 1, function() {
|
||||||
var actual = _.map(values, function(value) {
|
if (!isNpm) {
|
||||||
var wrapped = _(value);
|
var actual = _.map(values, function(value) {
|
||||||
return _(wrapped) === wrapped;
|
var wrapped = _(value);
|
||||||
});
|
return _(wrapped) === wrapped;
|
||||||
|
});
|
||||||
|
|
||||||
deepEqual(actual, expected);
|
deepEqual(actual, expected);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
skipTest();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
test('should convert foreign wrapped values to `lodash` instances', 1, function() {
|
test('should convert foreign wrapped values to `lodash` instances', 1, function() {
|
||||||
if (lodashBizarro) {
|
if (!isNpm && lodashBizarro) {
|
||||||
var actual = _.map(values, function(value) {
|
var actual = _.map(values, function(value) {
|
||||||
var wrapped = _(lodashBizarro(value)),
|
var wrapped = _(lodashBizarro(value)),
|
||||||
unwrapped = getUnwrappedValue(wrapped);
|
unwrapped = getUnwrappedValue(wrapped);
|
||||||
@@ -8651,19 +8661,24 @@
|
|||||||
source = { 'a': function(array) { return array[0]; }, 'b': 'B' };
|
source = { 'a': function(array) { return array[0]; }, 'b': 'B' };
|
||||||
|
|
||||||
test('should mixin `source` methods into lodash', 4, function() {
|
test('should mixin `source` methods into lodash', 4, function() {
|
||||||
_.mixin(source);
|
if (!isNpm) {
|
||||||
|
_.mixin(source);
|
||||||
|
|
||||||
strictEqual(_.a(value), 'a');
|
strictEqual(_.a(value), 'a');
|
||||||
strictEqual(getUnwrappedValue(_(value).a()), 'a');
|
strictEqual(getUnwrappedValue(_(value).a()), 'a');
|
||||||
|
|
||||||
delete _.a;
|
delete _.a;
|
||||||
delete _.prototype.a;
|
delete _.prototype.a;
|
||||||
|
|
||||||
ok(!('b' in _));
|
ok(!('b' in _));
|
||||||
ok(!('b' in _.prototype));
|
ok(!('b' in _.prototype));
|
||||||
|
|
||||||
delete _.b;
|
delete _.b;
|
||||||
delete _.prototype.b;
|
delete _.prototype.b;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
skipTest(4);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
test('should use `this` as the default `object` value', 3, function() {
|
test('should use `this` as the default `object` value', 3, function() {
|
||||||
|
|||||||
Reference in New Issue
Block a user