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