1
0
Fork 0
mirror of https://github.com/anyproto/any-sync.git synced 2025-06-08 14:07:02 +09:00

Make tests compile

This commit is contained in:
mcrakhman 2024-11-22 17:16:15 +01:00
parent 55f2655dba
commit 0705d1a6b8
No known key found for this signature in database
GPG key ID: DED12CFEF5B8396B
6 changed files with 227 additions and 210 deletions

View file

@ -76,6 +76,18 @@ type MockChangeCreator struct {
store anystore.DB
}
type testStorage struct {
Storage
errAdd error
}
func (t testStorage) AddAll(ctx context.Context, changes []StorageChange, heads []string, commonSnapshot string) error {
if t.errAdd != nil {
return t.errAdd
}
return t.Storage.AddAll(ctx, changes, heads, commonSnapshot)
}
func NewMockChangeCreator(store anystore.DB) *MockChangeCreator {
return &MockChangeCreator{
store: store,
@ -149,5 +161,7 @@ func (c *MockChangeCreator) CreateNewTreeStorage(t *testing.T, treeId, aclHeadId
root := c.CreateRoot(treeId, aclHeadId)
storage, err := createStorage(context.Background(), root, c.store)
require.NoError(t, err)
return storage
return testStorage{
Storage: storage,
}
}