graphql-engine/cli/commands/actions_create_test.go
Kali Vara Purushotham Santhati 9340a5b1cd cli: e2e tests for actions and seeds commands
Co-authored-by: Aravind K P <8335904+scriptonist@users.noreply.github.com>
GitOrigin-RevId: 9371c94b55cb375246784e53029fdece7db2fb58
2021-04-13 08:23:57 +00:00

71 lines
1.7 KiB
Go

package commands
// TODO: we should make this test check the user actual user interaction
// this can be done with some changes in how we get input from the user
/*
var _ = Describe("actions_create", func() {
var dirName string
var session *Session
var teardown func()
BeforeEach(func() {
dirName = testutil.RandDirName()
hgeEndPort, teardownHGE := testutil.StartHasura(GinkgoT(), testutil.HasuraVersion)
hgeEndpoint := fmt.Sprintf("http://0.0.0.0:%s", hgeEndPort)
testutil.RunCommandAndSucceed(testutil.CmdOpts{
Args: []string{"init", dirName},
})
editEndpointInConfig(filepath.Join(dirName, defaultConfigFilename), hgeEndpoint)
teardown = func() {
session.Kill()
os.RemoveAll(dirName)
teardownHGE()
}
})
AfterEach(func() {
teardown()
})
Context("actions create tests", func() {
data := `type Mutation {
# Define your action as a mutation here
action1 (arg1: SampleInput!): SampleOutput
}
type SampleOutput {
accessToken: String!
}
input SampleInput {
username: String!
password: String!
}`
It("should create a new action action1 ", func() {
filePath := filepath.Join(dirName, "action1.graphql")
file, err := os.Create(filePath)
if err != nil {
fmt.Println(err)
}
_, err = file.Write([]byte(data))
if err != nil {
fmt.Println(err)
}
file.Close()
session = testutil.Hasura(testutil.CmdOpts{
Args: []string{"actions", "create", "action1", "--file", filePath},
WorkingDirectory: dirName,
})
wantKeywordList := []string{
".*action created*.",
}
for _, keyword := range wantKeywordList {
Eventually(session, 60*40).Should(Say(keyword))
}
Eventually(session, 60*40).Should(Exit(0))
})
})
})
*/