diff options
Diffstat (limited to 'server/tests/api/utils.js')
-rw-r--r-- | server/tests/api/utils.js | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/server/tests/api/utils.js b/server/tests/api/utils.js index f0b1c3653..d505cb5d9 100644 --- a/server/tests/api/utils.js +++ b/server/tests/api/utils.js | |||
@@ -8,6 +8,7 @@ const pathUtils = require('path') | |||
8 | const request = require('supertest') | 8 | const request = require('supertest') |
9 | 9 | ||
10 | const testUtils = { | 10 | const testUtils = { |
11 | dateIsValid: dateIsValid, | ||
11 | flushTests: flushTests, | 12 | flushTests: flushTests, |
12 | getFriendsList: getFriendsList, | 13 | getFriendsList: getFriendsList, |
13 | getVideo: getVideo, | 14 | getVideo: getVideo, |
@@ -28,6 +29,16 @@ const testUtils = { | |||
28 | 29 | ||
29 | // ---------------------- Export functions -------------------- | 30 | // ---------------------- Export functions -------------------- |
30 | 31 | ||
32 | function dateIsValid (dateString) { | ||
33 | const dateToCheck = new Date(dateString) | ||
34 | const now = new Date() | ||
35 | |||
36 | // Check if the interval is more than 2 minutes | ||
37 | if (now - dateToCheck > 120000) return false | ||
38 | |||
39 | return true | ||
40 | } | ||
41 | |||
31 | function flushTests (callback) { | 42 | function flushTests (callback) { |
32 | exec('npm run clean:server:test', callback) | 43 | exec('npm run clean:server:test', callback) |
33 | } | 44 | } |