mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-11 11:27:50 +00:00
Cleanup date mocks.
This commit is contained in:
44
test/test.js
44
test/test.js
@@ -22454,19 +22454,13 @@
|
|||||||
var callCount = 0,
|
var callCount = 0,
|
||||||
dateCount = 0;
|
dateCount = 0;
|
||||||
|
|
||||||
var getTime = function() {
|
var lodash = _.runInContext({
|
||||||
return ++dateCount == 5
|
'Date': {
|
||||||
? Infinity
|
'now': function() {
|
||||||
: +new Date;
|
return ++dateCount == 5 ? Infinity : +new Date;
|
||||||
};
|
}
|
||||||
|
}
|
||||||
var lodash = _.runInContext(lodashStable.assign({}, root, {
|
});
|
||||||
'Date': lodashStable.assign(function() {
|
|
||||||
return { 'getTime': getTime };
|
|
||||||
}, {
|
|
||||||
'now': Date.now
|
|
||||||
})
|
|
||||||
}));
|
|
||||||
|
|
||||||
var throttled = lodash.throttle(function() { callCount++; }, 32);
|
var throttled = lodash.throttle(function() { callCount++; }, 32);
|
||||||
|
|
||||||
@@ -22647,7 +22641,7 @@
|
|||||||
var lodash = _.runInContext({
|
var lodash = _.runInContext({
|
||||||
'Date': {
|
'Date': {
|
||||||
'now': function() {
|
'now': function() {
|
||||||
return ++dateCount < 2 ? 0 : +new Date;
|
return ++dateCount == 1 ? 0 : +new Date;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -22766,19 +22760,15 @@
|
|||||||
var callCount = 0,
|
var callCount = 0,
|
||||||
dateCount = 0;
|
dateCount = 0;
|
||||||
|
|
||||||
var getTime = function() {
|
var lodash = _.runInContext({
|
||||||
return ++dateCount === 4
|
'Date': {
|
||||||
? +new Date(2012, 3, 23, 23, 27, 18)
|
'now': function() {
|
||||||
: +new Date;
|
return ++dateCount == 4
|
||||||
};
|
? +new Date(2012, 3, 23, 23, 27, 18)
|
||||||
|
: +new Date;
|
||||||
var lodash = _.runInContext(lodashStable.assign({}, root, {
|
}
|
||||||
'Date': lodashStable.assign(function() {
|
}
|
||||||
return { 'getTime': getTime, 'valueOf': getTime };
|
});
|
||||||
}, {
|
|
||||||
'now': Date.now
|
|
||||||
})
|
|
||||||
}));
|
|
||||||
|
|
||||||
var funced = lodash[methodName](function() {
|
var funced = lodash[methodName](function() {
|
||||||
callCount++;
|
callCount++;
|
||||||
|
|||||||
Reference in New Issue
Block a user