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

GO-2302: Fix tests; cleanup service

This commit is contained in:
Sergey 2023-11-01 16:33:21 +05:00
parent 4994d2b587
commit 2bf45920f8
No known key found for this signature in database
GPG key ID: 3B6BEF79160221C6
2 changed files with 1 additions and 7 deletions

View file

@ -46,14 +46,12 @@ type BuiltinTemplate interface {
type builtinTemplate struct {
source source.Service
objectStore objectstore.ObjectStore
spaceService space.Service
generatedHash string
}
func (b *builtinTemplate) Init(a *app.App) (err error) {
b.source = app.MustComponent[source.Service](a)
b.objectStore = app.MustComponent[objectstore.ObjectStore](a)
b.spaceService = app.MustComponent[space.Service](a)
b.makeGenHash(4)
return

View file

@ -29,9 +29,6 @@ func Test_registerBuiltin(t *testing.T) {
marketplaceSpace.EXPECT().Id().Return(addr.AnytypeMarketplaceWorkspace)
marketplaceSpace.EXPECT().Do(mock.Anything, mock.Anything).Return(nil)
spaceService := mock_space.NewMockService(t)
spaceService.EXPECT().Get(mock.Anything, addr.AnytypeMarketplaceWorkspace).Return(marketplaceSpace, nil)
objectStore := mock_objectstore.NewMockObjectStore(t)
builtInTemplates := New()
@ -39,13 +36,12 @@ func Test_registerBuiltin(t *testing.T) {
ctx := context.Background()
a := new(app.App)
a.Register(testutil.PrepareMock(ctx, a, sourceService))
a.Register(testutil.PrepareMock(ctx, a, spaceService))
a.Register(builtInTemplates)
a.Register(config.New())
a.Register(testutil.PrepareMock(ctx, a, objectStore))
err := builtInTemplates.Init(a)
assert.NoError(t, err)
err = builtInTemplates.Run(context.Background())
err = builtInTemplates.RegisterBuiltinTemplates(marketplaceSpace)
assert.NoError(t, err)
}