2023-04-03 09:53:36 +08:00
|
|
|
package teststore
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/stretchr/testify/require"
|
|
|
|
|
2024-02-20 23:02:01 +08:00
|
|
|
storepb "github.com/usememos/memos/proto/gen/store"
|
2023-06-29 22:55:03 +08:00
|
|
|
"github.com/usememos/memos/store"
|
2023-04-03 09:53:36 +08:00
|
|
|
)
|
|
|
|
|
2024-02-20 23:02:01 +08:00
|
|
|
func TestWorkspaceSettingV1Store(t *testing.T) {
|
|
|
|
ctx := context.Background()
|
|
|
|
ts := NewTestingStore(ctx, t)
|
2024-04-17 08:56:52 +08:00
|
|
|
workspaceSetting, err := ts.UpsertWorkspaceSetting(ctx, &storepb.WorkspaceSetting{
|
2024-05-13 20:03:04 +08:00
|
|
|
Key: storepb.WorkspaceSettingKey_GENERAL,
|
2024-04-10 20:05:17 +08:00
|
|
|
Value: &storepb.WorkspaceSetting_GeneralSetting{
|
|
|
|
GeneralSetting: &storepb.WorkspaceGeneralSetting{
|
2024-06-19 22:03:12 +08:00
|
|
|
AdditionalScript: "",
|
2024-02-20 23:02:01 +08:00
|
|
|
},
|
|
|
|
},
|
|
|
|
})
|
|
|
|
require.NoError(t, err)
|
2024-09-14 08:27:37 +08:00
|
|
|
setting, err := ts.GetWorkspaceSetting(ctx, &store.FindWorkspaceSetting{
|
|
|
|
Name: storepb.WorkspaceSettingKey_GENERAL.String(),
|
|
|
|
})
|
2024-02-20 23:02:01 +08:00
|
|
|
require.NoError(t, err)
|
2024-09-14 08:27:37 +08:00
|
|
|
require.Equal(t, workspaceSetting, setting)
|
2024-02-20 23:02:01 +08:00
|
|
|
ts.Close()
|
|
|
|
}
|