mirror of
https://github.com/grassrootseconomics/cic-chain-events.git
synced 2024-11-25 16:46:45 +01:00
Mohammed Sohail
df88d9df16
* update config to better defaults * add docs, inline and md * add context support throughout * replace json with goccy/go-json for better decoding of large JSON * update graphql fetcher: replace ioutil with io * test runner script (until CI is ready) * update CI build config
40 lines
764 B
Go
40 lines
764 B
Go
package fetch
|
|
|
|
import (
|
|
"context"
|
|
"os"
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/suite"
|
|
)
|
|
|
|
var (
|
|
graphqlEndpoint = os.Getenv("TEST_GRAPHQL_ENDPOINT")
|
|
)
|
|
|
|
type itGraphqlTest struct {
|
|
suite.Suite
|
|
graphqlFetcher Fetch
|
|
}
|
|
|
|
func TestPipelineSuite(t *testing.T) {
|
|
suite.Run(t, new(itGraphqlTest))
|
|
}
|
|
|
|
func (s *itGraphqlTest) SetupSuite() {
|
|
s.graphqlFetcher = NewGraphqlFetcher(GraphqlOpts{
|
|
GraphqlEndpoint: graphqlEndpoint,
|
|
})
|
|
}
|
|
|
|
func (s *itGraphqlTest) Test_E2E_Fetch_Existing_Block() {
|
|
resp, err := s.graphqlFetcher.Block(context.Background(), 14974600)
|
|
s.NoError(err)
|
|
s.Len(resp.Data.Block.Transactions, 3)
|
|
}
|
|
|
|
func (s *itGraphqlTest) Test_E2E_Fetch_Non_Existing_Block() {
|
|
_, err := s.graphqlFetcher.Block(context.Background(), 14974600000)
|
|
s.Error(err)
|
|
}
|