1
0
Fork 0
mirror of https://github.com/anyproto/anytype-heart.git synced 2025-06-11 10:18:28 +09:00

GO-3631 Fix space service tests

This commit is contained in:
mcrakhman 2024-10-01 21:43:26 +02:00
parent ce35860bc8
commit 406ac75b38
No known key found for this signature in database
GPG key ID: DED12CFEF5B8396B
3 changed files with 2846 additions and 6 deletions

View file

@ -64,7 +64,7 @@ func TestService_Init(t *testing.T) {
ctx2, ctxCancel2 := context.WithTimeout(context.Background(), time.Millisecond)
defer ctxCancel2()
factory.EXPECT().CreateAndSetTechSpace(ctx2).Return(&clientspace.TechSpace{}, nil)
factory.EXPECT().LoadAndSetTechSpace(ctx2).Return(&clientspace.TechSpace{}, nil)
require.NoError(t, serv.loadTechSpace(ctx2))
s, err := serv.Get(ctx2, serv.techSpaceId)
@ -240,12 +240,12 @@ func TestService_UpdateSharedLimits(t *testing.T) {
personalSpaceId: "spaceId",
techSpace: &clientspace.TechSpace{TechSpace: mockTechSpace},
}
mockSpaceView := mock_techspace.NewMockSpaceView(t)
mockTechSpace.EXPECT().DoSpaceView(ctx, "spaceId", mock.Anything).RunAndReturn(
func(ctx context.Context, spaceId string, f func(view techspace.SpaceView) error) error {
return f(mockSpaceView)
mockAccountObject := mock_techspace.NewMockAccountObject(t)
mockTechSpace.EXPECT().DoAccountObject(ctx, mock.Anything).RunAndReturn(
func(ctx context.Context, f func(view techspace.AccountObject) error) error {
return f(mockAccountObject)
})
mockSpaceView.EXPECT().SetSharedSpacesLimit(10).Return(nil)
mockAccountObject.EXPECT().SetSharedSpacesLimit(10).Return(nil)
// when
err := s.UpdateSharedLimits(ctx, 10)