mirror of
https://github.com/ENSL/ensl_gathers.git
synced 2024-11-22 12:41:11 +00:00
Archive using gather instance
This commit is contained in:
parent
a01a3e0216
commit
7f347e26cd
2 changed files with 18 additions and 0 deletions
|
@ -17,6 +17,11 @@ archivedGatherSchema.static({
|
|||
.sort({createdAt: -1})
|
||||
.limit(5)
|
||||
.exec(callback);
|
||||
},
|
||||
archive: function (gather, callback) {
|
||||
this.create({
|
||||
gather: gather.toJson()
|
||||
}, callback);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -70,6 +70,19 @@ describe("ArchivedGather", () => {
|
|||
});
|
||||
});
|
||||
|
||||
describe(".archive", () => {
|
||||
it ("archives a gather instance", done => {
|
||||
ArchivedGather.archive(gather, (error, result) => {
|
||||
if (error) return done(error);
|
||||
assert.isDefined(result.createdAt);
|
||||
let gather = result.gather;
|
||||
assert.equal(gather.gatherers.length, 12);
|
||||
assert.equal(gather.state, "done");
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe(".recent", () => {
|
||||
var gathers;
|
||||
beforeEach(done => {
|
||||
|
|
Loading…
Reference in a new issue