Finish test for .recent

This commit is contained in:
Chris Blanchard 2015-09-25 22:57:35 +01:00
parent 953dbded23
commit 1c0f001e4a

View file

@ -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();
});
});
});
});