timekeeper
Advanced tools
Comparing version 0.0.3 to 0.0.4
0.0.4 / 2013-11-22 | ||
================== | ||
* Add an isKeepingTime() function for reflection | ||
0.0.3 / 2012-08-08 | ||
@@ -3,0 +8,0 @@ ================== |
@@ -162,2 +162,11 @@ /** | ||
/** | ||
* Reflection: Are we currently modifying the native Date object? | ||
* | ||
* @api public | ||
*/ | ||
timekeeper.isKeepingTime = function() { | ||
return Date === FakeDate; | ||
}; | ||
/** | ||
* Replace the `Date` with `FakeDate`. | ||
@@ -164,0 +173,0 @@ */ |
{ | ||
"name": "timekeeper" | ||
, "description": "Easy testing of time-dependent code." | ||
, "version": "0.0.3" | ||
, "description": "Easy testing of time-dependent code." | ||
, "version": "0.0.4" | ||
, "keywords": ["fake date", "date test", "mocking date"] | ||
@@ -24,5 +24,2 @@ , "author": "Veselin Todorov <hi@vesln.com>" | ||
, "main": "./lib/timekeeper.js" | ||
, "engines": { | ||
"node": "x.x.x" | ||
} | ||
} |
@@ -22,3 +22,3 @@ [![Build Status](https://secure.travis-ci.org/vesln/timekeeper.png)](http://travis-ci.org/vesln/timekeeper) | ||
var tk = require('timekeeper'); | ||
var time = new Date(1330688329321); | ||
var time = new Date(1330688329321); | ||
@@ -36,3 +36,3 @@ tk.freeze(time); | ||
### Travel: | ||
### Travel: | ||
@@ -57,5 +57,17 @@ ```js | ||
### Reflection: | ||
```js | ||
var tk = require('timekeeper'); | ||
var time = new Date(1893448800000); // January 1, 2030 00:00:00 | ||
assertFalse(tk.isKeepingTime()); | ||
tk.travel(time); | ||
assertTrue(tk.isKeepingTime()); | ||
``` | ||
## Requirements | ||
- NPM (http://npmjs.org/) | ||
- npm (http://npmjs.org/) | ||
- Node.js (http://nodejs.org/) | ||
@@ -62,0 +74,0 @@ |
@@ -92,2 +92,12 @@ /** | ||
}); | ||
describe('reflection', function() { | ||
it('should know if time is being modified', function() { | ||
tk.isKeepingTime().should.be.eql(false); | ||
tk.freeze(new Date(1330688329321)); | ||
tk.isKeepingTime().should.be.eql(true); | ||
tk.reset(); | ||
tk.isKeepingTime().should.be.eql(false); | ||
}); | ||
}); | ||
}); |
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
Non-existent author
Supply chain riskThe package was published by an npm account that no longer exists.
Found 1 instance in 1 package
10105
251
113
0