users: add unset route for avatar

also add missing tests for avatar and profile locking
This commit is contained in:
Girish Ramakrishnan
2025-07-15 10:06:26 +02:00
parent be9adb64bb
commit 622aecfd6d
9 changed files with 122 additions and 3 deletions

View File

@@ -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);