api: expose user's inbox.optOut for api/v3/members/:memberId #7798 (#7893)

* api: expose user's inbox.optOut for `api/v3/members/:memberId` #7798

* test: fixed chai exist vs exists typos

* _getMembersForItem: fixed typo in api docs
This commit is contained in:
Jaka Kranjc
2016-08-16 05:21:14 +02:00
committed by Blade Barringer
parent 1a409848a8
commit 408d988341
10 changed files with 29 additions and 25 deletions

View File

@@ -79,15 +79,17 @@ describe('GET /groups/:groupId/members', () => {
expect(memberRes).to.have.all.keys([ // works as: object has all and only these keys
'_id', 'id', 'preferences', 'profile', 'stats', 'achievements', 'party',
'backer', 'contributor', 'auth', 'items',
'backer', 'contributor', 'auth', 'items', 'inbox',
]);
expect(Object.keys(memberRes.auth)).to.eql(['timestamps']);
expect(Object.keys(memberRes.preferences).sort()).to.eql(['size', 'hair', 'skin', 'shirt',
'chair', 'costume', 'sleep', 'background'].sort());
expect(memberRes.stats.maxMP).to.exists;
expect(memberRes.stats.maxMP).to.exist;
expect(memberRes.stats.maxHealth).to.equal(common.maxHealth);
expect(memberRes.stats.toNextLevel).to.equal(common.tnl(memberRes.stats.lvl));
expect(memberRes.inbox.optOut).to.exist;
expect(memberRes.inbox.messages).to.not.exist;
});
it('returns only first 30 members', async () => {

View File

@@ -32,15 +32,17 @@ describe('GET /members/:memberId', () => {
let memberRes = await user.get(`/members/${member._id}`);
expect(memberRes).to.have.all.keys([ // works as: object has all and only these keys
'_id', 'id', 'preferences', 'profile', 'stats', 'achievements', 'party',
'backer', 'contributor', 'auth', 'items',
'backer', 'contributor', 'auth', 'items', 'inbox',
]);
expect(Object.keys(memberRes.auth)).to.eql(['timestamps']);
expect(Object.keys(memberRes.preferences).sort()).to.eql(['size', 'hair', 'skin', 'shirt',
'chair', 'costume', 'sleep', 'background'].sort());
expect(memberRes.stats.maxMP).to.exists;
expect(memberRes.stats.maxMP).to.exist;
expect(memberRes.stats.maxHealth).to.equal(common.maxHealth);
expect(memberRes.stats.toNextLevel).to.equal(common.tnl(memberRes.stats.lvl));
expect(memberRes.inbox.optOut).to.exist;
expect(memberRes.inbox.messages).to.not.exist;
});
it('handles non-existing members', async () => {

View File

@@ -14,7 +14,7 @@ describe('GET /user', () => {
let returnedUser = await user.get('/user');
expect(returnedUser._id).to.equal(user._id);
expect(returnedUser.stats.maxMP).to.exists;
expect(returnedUser.stats.maxMP).to.exist;
expect(returnedUser.stats.maxHealth).to.equal(common.maxHealth);
expect(returnedUser.stats.toNextLevel).to.equal(common.tnl(returnedUser.stats.lvl));
});

View File

@@ -156,7 +156,7 @@ describe('POST /user/class/cast/:spellId', () => {
await groupLeader.post('/user/class/cast/earth');
await sleep(1);
await group.sync();
expect(group.chat[0]).to.exists;
expect(group.chat[0]).to.exist;
expect(group.chat[0].uuid).to.equal('system');
});