Sync profile source and message topic seq
This commit is contained in:
@@ -52,7 +52,22 @@ func TestProfilePublicFromFields(t *testing.T) {
|
||||
"avatar_file_id": "old_avatar",
|
||||
"public_account": "usrAccount",
|
||||
}, sql.NullString{Valid: true}, sql.NullString{Valid: true}).(map[string]any)
|
||||
if public["fn"] != "旧昵称" || public["avatar_file_id"] != "old_avatar" || public["public_account"] != "usrAccount" {
|
||||
t.Fatalf("empty profile fields should keep existing public values: %#v", public)
|
||||
for _, key := range []string{"fn", "name", "nickname", "display_name", "avatar_file_id", "photo", "avatar"} {
|
||||
if _, ok := public[key]; ok {
|
||||
t.Fatalf("legacy profile field %s should not be read from im_users.public: %#v", key, public)
|
||||
}
|
||||
}
|
||||
if public["public_account"] != "usrAccount" {
|
||||
t.Fatalf("unrelated public field changed: %#v", public)
|
||||
}
|
||||
}
|
||||
|
||||
func TestProfileSeedFromPublic(t *testing.T) {
|
||||
nickname, avatar := profileSeedFromPublic(map[string]any{
|
||||
"fn": "旧昵称",
|
||||
"photo": "file_avatar_1",
|
||||
})
|
||||
if nickname != "旧昵称" || avatar != "file_avatar_1" {
|
||||
t.Fatalf("unexpected profile seed nickname=%q avatar=%q", nickname, avatar)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user