Closed harked closed 3 years ago
@harked Thanks for creating this issue!
For the moment custom scalars are not supported on the input, would you like to create a PR for this?
@harked @estrada9166 I'm working on it.
@harked sorry, I think I misunderstood the issue.
If the type Upload
is defined in the schema as a scalar you can pass any value there, so it should be something like this:
tester.test(true, mutation, {
banner: 'custom-data',
username: 'test',
fullName: 'test',
password: 'test'
})
Another thing is that you have to set the mutation with the expected input, I mean:
const mutation = `
mutation CreateUser($banner: Upload!, $username: String!, $fullName: String!, $password: String!){
createUser(banner: $banner, username: $username, fullName: $fullname, password: $password) {
email
}
}
`
or
const mutation = `
mutation CreateUser($input: CreateUserInput!){
createUser(input: $input) {
email
}
}
`
Also, because you're not wrapping it in any test runner if it's correct it's not gonna show anything, but if you change the type of the value in one field on the mutation, it's gonna return an error.
You can use .mock
, if you want to have a mock of the mutation.
const mock = tester.mock({
query: mutation,
variables: {
banner: 'custom-data',
username: 'test',
fullName: 'test',
password: 'test'
}
})
If your mutation expect an input that is going to have different fields, you should pass the variables as
tester.test(true, mutation, {
input: {
banner: 'custom-data',
username: 'test',
fullName: 'test',
password: 'test'
}
})
@harked did this work for you? can we close this issue?
@estrada9166 sorry for so late reply. It works for me. Thanks. I'll close this issue now.
Hi, I want to test my mutation which have input type Upload. How to do that with EasyGraphQL?
I know we can pass the expected input on the third parameter (after Call test from tester).
on that above case.. if banner is input type Upload, how to do that in easygraphql?