test: fix most e2e tests

This commit is contained in:
2026-06-11 10:21:28 +02:00
parent 1671a04f03
commit b630bacdc6
9 changed files with 230 additions and 36 deletions

View File

@@ -79,4 +79,38 @@ describe('user avatar sync helpers', () => {
updatedAt: 100
})).toBe(false);
});
it('requests data when only the remote profile text is newer and no avatar exists', () => {
const existingUser = createUser({
displayName: 'Alice',
profileUpdatedAt: 100
});
expect(shouldRequestAvatarData(existingUser, {
avatarUpdatedAt: 0,
profileUpdatedAt: 200
})).toBe(true);
});
it('does not request profile data when the local profile is the same or newer', () => {
const existingUser = createUser({ profileUpdatedAt: 200 });
expect(shouldRequestAvatarData(existingUser, {
avatarUpdatedAt: 0,
profileUpdatedAt: 200
})).toBe(false);
});
it('applies profile-only transfers when the remote profile is newer', () => {
const existingUser = createUser({
displayName: 'Alice',
profileUpdatedAt: 100
});
expect(shouldApplyAvatarTransfer(existingUser, {
hash: undefined,
updatedAt: 0,
profileUpdatedAt: 200
})).toBe(true);
});
});