From 0f617548c9addd8b56f8cf9e8772bee4aeff1a92 Mon Sep 17 00:00:00 2001 From: bredele Date: Fri, 6 Apr 2018 08:41:07 -0600 Subject: [PATCH] Should sort valid and expired dates in ms --- package.json | 6 +++++- test/runout.js | 20 ++++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 82a9673..9dc6bad 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,7 @@ "keywords": [ "expires", "timestamp", + "date", "time" ], "author": "Olivier Wietrich", @@ -23,5 +24,8 @@ "bugs": { "url": "https://github.com/bredele/runout/issues" }, - "homepage": "https://github.com/bredele/runout#readme" + "homepage": "https://github.com/bredele/runout#readme", + "devDependencies": { + "tape": "^4.9.0" + } } diff --git a/test/runout.js b/test/runout.js index e69de29..707523e 100644 --- a/test/runout.js +++ b/test/runout.js @@ -0,0 +1,20 @@ +/** + * Dependencie(s) + */ + +const test = require('tape') +const runout = require('..') + + +test('should sort dates with given expiration limit', assert => { + assert.plan(1) + const obj = runout([ + new Date('01-01-2200').getTime(), + new Date('01-01-2100').getTime(), + new Date('01-01-2300').getTime(), + ], new Date('01-01-2101').getTime()) + assert.deepEqual(obj, { + valid: [7258143600000, 4102470000000], + expired: [10413817200000] + }) +})