mirror of
				https://github.com/usememos/memos.git
				synced 2025-10-31 16:59:30 +08:00 
			
		
		
		
	It's just a matter of explicitly closing the database, so that TempDir.removeAll doesn't fail.
		
			
				
	
	
		
			28 lines
		
	
	
	
		
			703 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			28 lines
		
	
	
	
		
			703 B
		
	
	
	
		
			Go
		
	
	
	
	
	
| package teststore
 | |
| 
 | |
| import (
 | |
| 	"context"
 | |
| 	"testing"
 | |
| 
 | |
| 	"github.com/stretchr/testify/require"
 | |
| 
 | |
| 	storepb "github.com/usememos/memos/proto/gen/store"
 | |
| 	"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, &storepb.UserSetting{
 | |
| 		UserId: user.ID,
 | |
| 		Key:    storepb.UserSettingKey_USER_SETTING_LOCALE,
 | |
| 		Value:  &storepb.UserSetting_Locale{Locale: "en"},
 | |
| 	})
 | |
| 	require.NoError(t, err)
 | |
| 	list, err := ts.ListUserSettings(ctx, &store.FindUserSetting{})
 | |
| 	require.NoError(t, err)
 | |
| 	require.Equal(t, 1, len(list))
 | |
| 	ts.Close()
 | |
| }
 |