소스 검색

Update stats tests

production
Jack Foltz 5 년 전
부모
커밋
5f0592d976
로그인 계정: foltik <jack@foltz.io> GPG 키 ID: D1F0331758D1F29A
2개의 변경된 파일33개의 추가작업 그리고 5개의 파일을 삭제
  1. +28
    -0
      test/api.js
  2. +5
    -5
      test/testUtil.js

+ 28
- 0
test/api.js 파일 보기

@@ -1012,6 +1012,20 @@ describe('Stats', () => {

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


+ 5
- 5
test/testUtil.js 파일 보기

@@ -33,11 +33,11 @@ exports.verifyResponseObj = (res, status, obj) => {

exports.clearDatabase = () =>
Promise.all([
User.remove({}),
Invite.remove({}),
Key.remove({}),
Upload.remove({}),
View.remove({})
User.deleteMany(),
Invite.deleteMany(),
Key.deleteMany(),
Upload.deleteMany(),
View.deleteMany()
]);

exports.insertInvite = invite =>


불러오는 중...
취소
저장