tests(persistence): add missing test for author payload API
This commit is contained in:
parent
d89c0c8d9e
commit
bca26fbdd9
|
@ -1517,3 +1517,28 @@ func TestSaveDiscordMessages(t *testing.T) {
|
|||
require.EqualValues(t, "2", dm.Author.Id)
|
||||
}
|
||||
}
|
||||
|
||||
func TestUpdateDiscordMessageAuthorImage(t *testing.T) {
|
||||
|
||||
db, err := openTestDB()
|
||||
require.NoError(t, err)
|
||||
p := newSQLitePersistence(db)
|
||||
|
||||
require.NoError(t, p.SaveDiscordMessageAuthor(&protobuf.DiscordMessageAuthor{
|
||||
Id: "1",
|
||||
Name: "Testuser",
|
||||
Discriminator: "1234",
|
||||
Nickname: "User",
|
||||
AvatarUrl: "http://example.com/profile.jpg",
|
||||
}))
|
||||
|
||||
exists, err := p.HasDiscordMessageAuthor("1")
|
||||
require.NoError(t, err)
|
||||
require.True(t, exists)
|
||||
|
||||
err = p.UpdateDiscordMessageAuthorImage("1", []byte{0, 1, 2, 3})
|
||||
require.NoError(t, err)
|
||||
payload, err := p.GetDiscordMessageAuthorImagePayloadByID("1")
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, []byte{0, 1, 2, 3}, payload)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue