forked from canada-ca/tracker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdomain-result.test.js
More file actions
38 lines (31 loc) · 1.18 KB
/
Copy pathdomain-result.test.js
File metadata and controls
38 lines (31 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
import {GraphQLString} from 'graphql'
import {domainResultType} from '../domain-result'
import {domainType} from '../domain'
describe('given the domainResultType object', () => {
describe('testing the field definitions', () => {
it('has an status field', () => {
const demoType = domainResultType.getFields()
expect(demoType).toHaveProperty('status')
expect(demoType.status.type).toMatchObject(GraphQLString)
})
it('has a domain type', () => {
const demoType = domainResultType.getFields()
expect(demoType).toHaveProperty('domain')
expect(demoType.domain.type).toMatchObject(domainType)
})
})
describe('testing the field resolvers', () => {
describe('testing the status resolver', () => {
it('returns the resolved field', () => {
const demoType = domainResultType.getFields()
expect(demoType.status.resolve({status: 'status'})).toEqual('status')
})
})
describe('testing the domain resolver', () => {
const demoType = domainResultType.getFields()
expect(
demoType.domain.resolve({domain: {id: 1, domain: 'test.gc.ca'}}),
).toEqual({id: 1, domain: 'test.gc.ca'})
})
})
})