mirror of
https://github.com/Foltik/Shimapan
synced 2024-11-30 14:31:42 -05:00
Update stats tests
This commit is contained in:
parent
3c431d9b57
commit
5f0592d976
28
test/api.js
28
test/api.js
@ -1012,6 +1012,20 @@ describe('Stats', () => {
|
|||||||
|
|
||||||
return util.logout(agent);
|
return util.logout(agent);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('must return an empty set when there are no stats', async () => {
|
||||||
|
await util.createSession(agent, ['stats.get'], 'user');
|
||||||
|
const stats_self = (await util.getStatsWeek(agent)).body;
|
||||||
|
stats_self.should.deep.equal({});
|
||||||
|
|
||||||
|
|
||||||
|
await setupUploadsAndViews();
|
||||||
|
await util.createSession(agent, ['stats.get'], 'other_user');
|
||||||
|
const stats_other = (await util.getStatsWeek(agent)).body;
|
||||||
|
stats_other.should.deep.equal({}, 'No stats should be returned from another user');
|
||||||
|
|
||||||
|
return util.logout(agent);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -1028,7 +1042,21 @@ describe('Stats', () => {
|
|||||||
stats.total.should.have.property('size').equal(8);
|
stats.total.should.have.property('size').equal(8);
|
||||||
stats.total.should.have.property('views').equal(8);
|
stats.total.should.have.property('views').equal(8);
|
||||||
|
|
||||||
|
return util.logout(agent);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('must return an empty set when there are no stats', async () => {
|
||||||
|
await util.createSession(agent, ['stats.get'], 'user');
|
||||||
|
const stats_self = (await util.getStatsAll(agent)).body;
|
||||||
|
stats_self.should.deep.equal({}, 'No stats should be returned');
|
||||||
await util.logout(agent);
|
await util.logout(agent);
|
||||||
|
|
||||||
|
await setupUploadsAndViews();
|
||||||
|
await util.createSession(agent, ['stats.get'], 'other_user');
|
||||||
|
const stats_other = (await util.getStatsAll(agent)).body;
|
||||||
|
stats_other.should.deep.equal({}, 'No stats should be returned from another user');
|
||||||
|
|
||||||
|
return util.logout(agent);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -33,11 +33,11 @@ exports.verifyResponseObj = (res, status, obj) => {
|
|||||||
|
|
||||||
exports.clearDatabase = () =>
|
exports.clearDatabase = () =>
|
||||||
Promise.all([
|
Promise.all([
|
||||||
User.remove({}),
|
User.deleteMany(),
|
||||||
Invite.remove({}),
|
Invite.deleteMany(),
|
||||||
Key.remove({}),
|
Key.deleteMany(),
|
||||||
Upload.remove({}),
|
Upload.deleteMany(),
|
||||||
View.remove({})
|
View.deleteMany()
|
||||||
]);
|
]);
|
||||||
|
|
||||||
exports.insertInvite = invite =>
|
exports.insertInvite = invite =>
|
||||||
|
Loading…
Reference in New Issue
Block a user