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