mirror of
https://github.com/usememos/memos.git
synced 2024-11-16 03:34:33 +08:00
32 lines
715 B
Go
32 lines
715 B
Go
package teststore
|
|
|
|
import (
|
|
"context"
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/require"
|
|
|
|
"github.com/usememos/memos/store"
|
|
)
|
|
|
|
func TestUserSettingStore(t *testing.T) {
|
|
ctx := context.Background()
|
|
ts := NewTestingStore(ctx, t)
|
|
user, err := createTestingHostUser(ctx, ts)
|
|
require.NoError(t, err)
|
|
_, err = ts.UpsertUserSetting(ctx, &store.UserSetting{
|
|
UserID: user.ID,
|
|
Key: "test_key",
|
|
Value: "test_value",
|
|
})
|
|
require.NoError(t, err)
|
|
_, err = ts.UpsertUserSetting(ctx, &store.UserSetting{
|
|
UserID: user.ID,
|
|
Key: "locale",
|
|
Value: "zh",
|
|
})
|
|
require.NoError(t, err)
|
|
list, err := ts.ListUserSettings(ctx, &store.FindUserSetting{})
|
|
require.NoError(t, err)
|
|
require.Equal(t, 2, len(list))
|
|
}
|