From 1c0f001e4a3f5267f76832c2fbbc315026f99112 Mon Sep 17 00:00:00 2001 From: Chris Blanchard Date: Fri, 25 Sep 2015 22:57:35 +0100 Subject: [PATCH] Finish test for .recent --- spec/archivedGather.js | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/spec/archivedGather.js b/spec/archivedGather.js index a2b4ee4..5e745c5 100644 --- a/spec/archivedGather.js +++ b/spec/archivedGather.js @@ -97,17 +97,19 @@ describe("ArchivedGather", () => { }); }); }); - // it ("returns 5 most recent gathers", done => { - // let lastFive = gathers.slice(Math.max(gathers.length - 5, 1)); - // ArchivedGather.recent((error, results) => { - // if (error) return done(error); - // assert.equal(results.length, 5); - // lastFive.forEach(recent => { - // assert.isTrue(results.some(result => { - // return result.gather.done.time === recent.done.time; - // })); - // }); - // }); - // }); + it ("returns 5 most recent gathers", done => { + let lastFive = gathers.slice(Math.max(gathers.length - 5, 1)); + ArchivedGather.recent((error, results) => { + if (error) return done(error); + assert.equal(results.length, 5); + lastFive.forEach(recent => { + assert.isTrue(results.some(result => { + return result.gather.done.time.getTime() + === recent.gather.done.time.getTime(); + })); + }); + done(); + }); + }); }); }); \ No newline at end of file