1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
|
From 0e6720542dd9a4a4d29fb772a56591736e8f4691 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bastien=20ROUCARI=C3=88S?= <roucaries.bastien@gmail.com>
Date: Fri, 6 Jan 2017 10:37:44 +0100
Subject: [PATCH] Fix testsuite
Save date a begining of test
Forwarded: Yes, https://github.com/alexei/sprintf.js/issues/119
bug: https://github.com/alexei/sprintf.js/issues/119
debian-bug: https://bugs.debian.org/849971
---
test/test.js | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/test/test.js b/test/test.js
index 6f57b25..fb2de04 100644
--- a/test/test.js
+++ b/test/test.js
@@ -3,6 +3,14 @@ var assert = require("assert"),
sprintf = sprintfjs.sprintf,
vsprintf = sprintfjs.vsprintf
+/* fixed date */
+Date.nowb = function now(b) {
+ if(typeof Date.nowb.begin == 'undefined')
+ Date.nowb.begin = Date.now();
+ return Date.nowb.begin;
+};
+
+
describe("sprintfjs", function() {
var pi = 3.141592653589793
@@ -77,6 +85,6 @@ describe("sprintfjs", function() {
it("should return formated strings for callbacks", function() {
assert.equal("foobar", sprintf("%s", function() { return "foobar" }))
- assert.equal(Date.now(), sprintf("%s", Date.now)) // should pass...
+ assert.equal(Date.nowb(), sprintf("%s", Date.nowb)) // should pass...
})
})
|