github.com/Tri-stone/burrow@v0.25.0/vent/sqlsol/spec_loader_test.go (about)

     1  package sqlsol_test
     2  
     3  import (
     4  	"os"
     5  	"testing"
     6  
     7  	"github.com/hyperledger/burrow/vent/sqlsol"
     8  	"github.com/hyperledger/burrow/vent/types"
     9  	"github.com/stretchr/testify/require"
    10  )
    11  
    12  func TestSpecLoader(t *testing.T) {
    13  	specFile := []string{os.Getenv("GOPATH") + "/src/github.com/hyperledger/burrow/vent/test/sqlsol_example.json"}
    14  	dBBlockTx := true
    15  	t.Run("successfully add block and transaction tables to event structures", func(t *testing.T) {
    16  		projection, err := sqlsol.SpecLoader(specFile, dBBlockTx)
    17  		require.NoError(t, err)
    18  
    19  		require.Equal(t, 4, len(projection.Tables))
    20  
    21  		require.Equal(t, types.SQLBlockTableName, projection.Tables[types.SQLBlockTableName].Name)
    22  
    23  		require.Equal(t, types.SQLColumnLabelHeight,
    24  			projection.Tables[types.SQLBlockTableName].GetColumn(types.SQLColumnLabelHeight).Name)
    25  
    26  		require.Equal(t, types.SQLTxTableName, projection.Tables[types.SQLTxTableName].Name)
    27  
    28  		require.Equal(t, types.SQLColumnLabelTxHash,
    29  			projection.Tables[types.SQLTxTableName].GetColumn(types.SQLColumnLabelTxHash).Name)
    30  	})
    31  }