mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-12-15 17:31:56 +03:00
d8198a8bad
- remove `HASURA_TEST_CLI_HGE_DOCKER_TAG` & `HASURA_TEST_CLI_HGE_DOCKER_REPO` env variables - add `HASURA_TEST_CLI_HGE_DOCKER_IMAGE` environment variable to configure hge image used in tests - add template test project directories - add helper functions to manipulate the template projects in individual tests - add config v2 tests Co-authored-by: Kali Vara Purushotham Santhati <72007599+purush7@users.noreply.github.com> GitOrigin-RevId: 009a74c042861ff0a8dec2b06002e55de3a8a629
71 lines
1.7 KiB
Go
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.HasuraDockerImage)
|
|
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))
|
|
})
|
|
})
|
|
})
|
|
*/
|