From 8d30905858245f12a42fc327d2d57cbfe062d548 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Sun, 7 Aug 2016 22:09:59 +0200 Subject: Server: split tests utils in multiple files --- server/tests/utils/miscs.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 server/tests/utils/miscs.js (limited to 'server/tests/utils/miscs.js') diff --git a/server/tests/utils/miscs.js b/server/tests/utils/miscs.js new file mode 100644 index 000000000..5414cd561 --- /dev/null +++ b/server/tests/utils/miscs.js @@ -0,0 +1,21 @@ +'use strict' + +const miscsUtils = { + dateIsValid: dateIsValid +} + +// ---------------------- Export functions -------------------- + +function dateIsValid (dateString) { + const dateToCheck = new Date(dateString) + const now = new Date() + + // Check if the interval is more than 2 minutes + if (now - dateToCheck > 120000) return false + + return true +} + +// --------------------------------------------------------------------------- + +module.exports = miscsUtils -- cgit v1.2.3