Skip to content

Instantly share code, notes, and snippets.

@aofleejay
Last active May 30, 2018 15:57
Show Gist options
  • Save aofleejay/d34df8825e8a1952c495d725dd60cade to your computer and use it in GitHub Desktop.
Save aofleejay/d34df8825e8a1952c495d725dd60cade to your computer and use it in GitHub Desktop.
Test Character type
import { GraphQLString, GraphQLNonNull } from 'graphql'
import { expect } from 'chai'
import rootSchema from '../../src/schemas/rootSchema'
describe('Test schema', () => {
it('has correct character schema', () => {
const characterSchema = rootSchema.getTypeMap().Character.getFields()
expect(characterSchema).to.have.property('name')
expect(characterSchema.name.type).to.deep.equals(GraphQLString)
expect(characterSchema).to.have.property('id')
expect(characterSchema.id.type).to.deep.equals(new GraphQLNonNull(GraphQLString))
expect(characterSchema).to.have.property('gender')
expect(characterSchema.gender.type).to.deep.equals(rootSchema.getTypeMap().Gender)
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment