aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMatthew Bergman <[email protected]>2014-07-22 16:13:47 -0400
committerMatthew Bergman <[email protected]>2014-07-22 16:13:47 -0400
commit503e1983a0181191efcc9ba174d2586a778ab06a (patch)
treec9f904cfd51a56d64f336ceb7de50e2a9b0440c8 /test
parent40256d5cba2f8dad0e303f4976a15372d45129da (diff)
parentaae6d9720e77f5f371a865e65eac9cd26626008d (diff)
downloadfaker-503e1983a0181191efcc9ba174d2586a778ab06a.tar.xz
faker-503e1983a0181191efcc9ba174d2586a778ab06a.zip
Merge pull request #86 from northernv/fix-future-date
Ensure Date.future returns a date in the future.
Diffstat (limited to 'test')
-rw-r--r--test/date.unit.js8
1 files changed, 8 insertions, 0 deletions
diff --git a/test/date.unit.js b/test/date.unit.js
index 39f96a79..5f78cd5d 100644
--- a/test/date.unit.js
+++ b/test/date.unit.js
@@ -31,6 +31,14 @@ describe("date.js", function () {
assert.ok(Date.parse(date) > new Date());
});
+ it("returns a future date when N = 0", function () {
+
+ var refDate = new Date();
+ var date = Date.parse(Faker.Date.future(0), refDate.toJSON());
+
+ assert.ok(date > refDate); // date should be after the date given, but before the current time
+ });
+
it("returns a date N years after the date given", function () {
var refDate = new Date(1880, 11, 9, 10, 0, 0, 0); // set the date beyond the usual calculation (to make sure this is working correctly)