mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-12-15 09:22:43 +03:00
bb63d7e60e
Co-authored-by: Rishichandra Wawhal <rishichandra.wawhal@gmail.com> Co-authored-by: Rikin Kachhia <54616969+rikinsk@users.noreply.github.com> Co-authored-by: Aravind <aravindkp@outlook.in> Co-authored-by: Anon Ray <ecthiender@users.noreply.github.com> Co-authored-by: Shahidh K Muhammed <muhammedshahid.k@gmail.com>
46 lines
1007 B
Go
46 lines
1007 B
Go
package integrationtest
|
|
|
|
import (
|
|
"math/rand"
|
|
"testing"
|
|
"time"
|
|
|
|
"github.com/hasura/graphql-engine/cli"
|
|
)
|
|
|
|
func init() {
|
|
rand.Seed(time.Now().UTC().UnixNano())
|
|
}
|
|
|
|
func TestPrepare(t *testing.T, ec *cli.ExecutionContext) {
|
|
err := ec.Prepare()
|
|
if err != nil {
|
|
t.Fatalf("prepare failed: %v", err)
|
|
}
|
|
if ec.CMDName == "" {
|
|
t.Fatalf("expected CMDName, got: %v", ec.CMDName)
|
|
}
|
|
if ec.Spinner == nil {
|
|
t.Fatal("got spinner empty")
|
|
}
|
|
if ec.Logger == nil {
|
|
t.Fatal("got empty logger")
|
|
}
|
|
if ec.GlobalConfigDir == "" {
|
|
t.Fatalf("global config dir: expected $HOME/%s, got %s", cli.GlobalConfigDirName, ec.GlobalConfigDir)
|
|
}
|
|
if ec.GlobalConfigFile == "" {
|
|
t.Fatalf("global config file: expected $HOME/%s/%s, got %s", cli.GlobalConfigDirName, cli.GlobalConfigFileName, ec.GlobalConfigFile)
|
|
}
|
|
if ec.Config == nil {
|
|
t.Fatal("got empty Config")
|
|
}
|
|
}
|
|
|
|
func TestValidate(t *testing.T, ec *cli.ExecutionContext) {
|
|
err := ec.Validate()
|
|
if err != nil {
|
|
t.Fatalf("validate failed: %v", err)
|
|
}
|
|
}
|