users: add unset route for avatar
also add missing tests for avatar and profile locking
This commit is contained in:
@@ -578,6 +578,32 @@ describe('User', function () {
|
||||
});
|
||||
});
|
||||
|
||||
describe('avatar', function () {
|
||||
before(createOwner);
|
||||
|
||||
it('default avatar is empty', async function () {
|
||||
const result = await users.get(admin.id);
|
||||
expect(result.avatar).to.be(undefined); // should not be in 'get'
|
||||
|
||||
const result2 = await users.getAvatar(result);
|
||||
expect(result2).to.be(null);
|
||||
});
|
||||
|
||||
it('set avatar', async function () {
|
||||
await users.setAvatar(admin, Buffer.from('ABC'));
|
||||
|
||||
const avatar = await users.getAvatar(admin);
|
||||
expect(avatar).to.be.eql(Buffer.from('ABC'));
|
||||
});
|
||||
|
||||
it('reset avatar', async function () {
|
||||
await users.setAvatar(admin, null);
|
||||
|
||||
const avatar = await users.getAvatar(admin);
|
||||
expect(avatar).to.be(null);
|
||||
});
|
||||
});
|
||||
|
||||
describe('invite', function () {
|
||||
before(createOwner);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user