workspace_setting_test.go 805 B

12345678910111213141516171819202122232425262728293031
  1. package teststore
  2. import (
  3. "context"
  4. "testing"
  5. "github.com/stretchr/testify/require"
  6. storepb "github.com/usememos/memos/proto/gen/store"
  7. "github.com/usememos/memos/store"
  8. )
  9. func TestWorkspaceSettingV1Store(t *testing.T) {
  10. ctx := context.Background()
  11. ts := NewTestingStore(ctx, t)
  12. workspaceSetting, err := ts.UpsertWorkspaceSetting(ctx, &storepb.WorkspaceSetting{
  13. Key: storepb.WorkspaceSettingKey_GENERAL,
  14. Value: &storepb.WorkspaceSetting_GeneralSetting{
  15. GeneralSetting: &storepb.WorkspaceGeneralSetting{
  16. AdditionalScript: "",
  17. },
  18. },
  19. })
  20. require.NoError(t, err)
  21. setting, err := ts.GetWorkspaceSetting(ctx, &store.FindWorkspaceSetting{
  22. Name: storepb.WorkspaceSettingKey_GENERAL.String(),
  23. })
  24. require.NoError(t, err)
  25. require.Equal(t, workspaceSetting, setting)
  26. ts.Close()
  27. }