package cushion_test import ( "context" "testing" "github.com/go-kivik/kivik/v4" "github.com/stretchr/testify/assert" "edge-infra.dev/pkg/edge/chariot" "edge-infra.dev/pkg/edge/datasync/cushion" ) func TestPutWithEmptyObjects(t *testing.T) { storage := cushion.NewCouchDBStorage(&kivik.Client{}, nil) info, err := storage.Put(context.Background(), &kivik.DB{}, []chariot.StorageObject{}...) assert.NoError(t, err) assert.True(t, info.ObjectsEmpty) } func TestPutWithMultipleObjects(t *testing.T) { storage := cushion.NewCouchDBStorage(&kivik.Client{}, nil) _, err := storage.Put(context.Background(), &kivik.DB{}, chariot.StorageObject{}, chariot.StorageObject{}) assert.Error(t, err) } func TestDeleteWithEmptyObjects(t *testing.T) { storage := cushion.NewCouchDBStorage(&kivik.Client{}, nil) info, err := storage.Delete(context.Background(), &kivik.DB{}, []chariot.StorageObject{}...) assert.NoError(t, err) assert.True(t, info.ObjectsEmpty) } func TestDeleteWithMultipleObjects(t *testing.T) { storage := cushion.NewCouchDBStorage(&kivik.Client{}, nil) _, err := storage.Delete(context.Background(), &kivik.DB{}, chariot.StorageObject{}, chariot.StorageObject{}) assert.Error(t, err) }