jest-date-mock
Advanced tools
Comparing version 1.0.2 to 1.0.3
@@ -32,2 +32,10 @@ 'use strict'; | ||
// mock Date class | ||
global.window.Date = (0, _mockDate.mockDateClass)(window.Date); | ||
var dateClass = (0, _mockDate.mockDateClass)(Date); | ||
if (global.window) { | ||
// dom env | ||
global.window.Date = dateClass; | ||
} else { | ||
// node / native env | ||
global.Date = dateClass; | ||
} |
@@ -25,8 +25,5 @@ 'use strict'; | ||
var d = new (Function.prototype.bind.apply(D, [null].concat(_toConsumableArray(p.length === 0 ? [mockNow()] : p))))(); | ||
MD.prototype = D.prototype; | ||
return d; | ||
return new (Function.prototype.bind.apply(D, [null].concat(_toConsumableArray(p.length === 0 ? [mockNow()] : p))))(); | ||
}; | ||
MD.prototype = D.prototype; | ||
@@ -33,0 +30,0 @@ // undefined means do not mock date |
{ | ||
"name": "jest-date-mock", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"description": "Mock `window.Date` when run unit test cases with jest. Make tests of `Date` easier.", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
6924
106