-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathdomain-error.test.js
More file actions
39 lines (32 loc) · 1.18 KB
/
domain-error.test.js
File metadata and controls
39 lines (32 loc) · 1.18 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
37
38
39
import {GraphQLInt, GraphQLString} from 'graphql'
import {domainErrorType} from '../domain-error'
describe('given the domainErrorType object', () => {
describe('testing the field definitions', () => {
it('has an code field', () => {
const demoType = domainErrorType.getFields()
expect(demoType).toHaveProperty('code')
expect(demoType.code.type).toMatchObject(GraphQLInt)
})
it('has a description field', () => {
const demoType = domainErrorType.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 = domainErrorType.getFields()
expect(demoType.code.resolve({code: 400})).toEqual(400)
})
})
describe('testing the description field', () => {
it('returns the resolved value', () => {
const demoType = domainErrorType.getFields()
expect(
demoType.description.resolve({description: 'description'}),
).toEqual('description')
})
})
})
})