Skip to content

Commit

Permalink
Should sort valid and expired dates in ms
Browse files Browse the repository at this point in the history
  • Loading branch information
bredele committed Apr 6, 2018
1 parent de7e50d commit 0f61754
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,16 @@
"keywords": [
"expires",
"timestamp",
"date",
"time"
],
"author": "Olivier Wietrich",
"license": "MIT",
"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"
}
}
20 changes: 20 additions & 0 deletions test/runout.js
Original file line number Diff line number Diff line change
@@ -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]
})
})

0 comments on commit 0f61754

Please sign in to comment.