forked from canada-ca/tracker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcomplete-tour-error.test.js
More file actions
36 lines (30 loc) · 1.19 KB
/
Copy pathcomplete-tour-error.test.js
File metadata and controls
36 lines (30 loc) · 1.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import { GraphQLInt, GraphQLString } from 'graphql'
import { completeTourError } from '../complete-tour-error'
describe('given the completeTourError object', () => {
describe('testing the field definitions', () => {
it('has an code field', () => {
const demoType = completeTourError.getFields()
expect(demoType).toHaveProperty('code')
expect(demoType.code.type).toMatchObject(GraphQLInt)
})
it('has a description field', () => {
const demoType = completeTourError.getFields()
expect(demoType).toHaveProperty('description')
expect(demoType.description.type).toMatchObject(GraphQLString)
})
})
describe('testing the field resolvers', () => {
describe('testing the code resolver', () => {
it('returns the resolved field', () => {
const demoType = completeTourError.getFields()
expect(demoType.code.resolve({ code: 400 })).toEqual(400)
})
})
describe('testing the description field', () => {
it('returns the resolved value', () => {
const demoType = completeTourError.getFields()
expect(demoType.description.resolve({ description: 'description' })).toEqual('description')
})
})
})
})