Follow @mattwr18 code review 👍

This commit is contained in:
Robert Schäfer 2019-07-03 22:22:32 +02:00
parent 10ae4abaae
commit ef46f71c0d
2 changed files with 31 additions and 23 deletions

View File

@ -12,7 +12,12 @@ afterEach(async () => {
describe('users', () => { describe('users', () => {
describe('User', () => { describe('User', () => {
const query = `query($email: String) { User(email: $email) { id } }` describe('query by email address', () => {
beforeEach(async () => {
await factory.create('User', { name: 'Johnny', email: 'any-email-address@example.org' })
})
const query = `query($email: String) { User(email: $email) { name } }`
const variables = { email: 'any-email-address@example.org' } const variables = { email: 'any-email-address@example.org' }
beforeEach(() => { beforeEach(() => {
client = new GraphQLClient(host) client = new GraphQLClient(host)
@ -36,7 +41,10 @@ describe('users', () => {
}) })
it('is permitted', async () => { it('is permitted', async () => {
await expect(client.request(query, variables)).resolves.toEqual({ User: [] }) await expect(client.request(query, variables)).resolves.toEqual({
User: [{ name: 'Johnny' }],
})
})
}) })
}) })
}) })

View File

@ -141,7 +141,7 @@ type Query {
first: Int first: Int
offset: Int offset: Int
orderBy: [_UserOrdering] orderBy: [_UserOrdering]
filter: _UserFilter # adding this would expose email filter: _UserFilter
): [User] ): [User]
} }