mirror of
https://github.com/ENSL/ensl_gathers.git
synced 2025-02-18 09:51:26 +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})
|
.sort({createdAt: -1})
|
||||||
.limit(5)
|
.limit(5)
|
||||||
.exec(callback);
|
.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", () => {
|
describe(".recent", () => {
|
||||||
var gathers;
|
var gathers;
|
||||||
beforeEach(done => {
|
beforeEach(done => {
|
||||||
|
|
Loading…
Reference in a new issue