forked from canada-ca/tracker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcreate-domain-union.test.js
More file actions
43 lines (38 loc) · 1.18 KB
/
create-domain-union.test.js
File metadata and controls
43 lines (38 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
40
41
42
43
import { domainErrorType, domainType } from '../../objects/index'
import { createDomainUnion } from '../create-domain-union'
describe('given the createDomainUnion', () => {
describe('testing the field types', () => {
it('contains domainType', () => {
const demoType = createDomainUnion.getTypes()
expect(demoType).toContain(domainType)
})
it('contains domainErrorType', () => {
const demoType = createDomainUnion.getTypes()
expect(demoType).toContain(domainErrorType)
})
})
describe('testing the field selection', () => {
describe('testing the domainType', () => {
it('returns the correct type', () => {
const obj = {
_type: 'domain',
domain: {},
}
expect(createDomainUnion.resolveType(obj)).toMatchObject(domainType)
})
})
describe('testing the domainErrorType', () => {
it('returns the correct type', () => {
const obj = {
_type: 'error',
error: 'sign-in-error',
code: 401,
description: 'text',
}
expect(createDomainUnion.resolveType(obj)).toMatchObject(
domainErrorType,
)
})
})
})
})