github.com/onflow/flow-go@v0.33.17/storage/badger/operation/results_test.go (about) 1 // (c) 2019 Dapper Labs - ALL RIGHTS RESERVED 2 3 package operation 4 5 import ( 6 "testing" 7 8 "github.com/dgraph-io/badger/v2" 9 "github.com/stretchr/testify/assert" 10 "github.com/stretchr/testify/require" 11 12 "github.com/onflow/flow-go/model/flow" 13 "github.com/onflow/flow-go/utils/unittest" 14 ) 15 16 func TestResults_InsertRetrieve(t *testing.T) { 17 unittest.RunWithBadgerDB(t, func(db *badger.DB) { 18 expected := unittest.ExecutionResultFixture() 19 20 err := db.Update(InsertExecutionResult(expected)) 21 require.Nil(t, err) 22 23 var actual flow.ExecutionResult 24 err = db.View(RetrieveExecutionResult(expected.ID(), &actual)) 25 require.Nil(t, err) 26 27 assert.Equal(t, expected, &actual) 28 }) 29 }