-
Notifications
You must be signed in to change notification settings - Fork 20
/
UserCreate.test.js
40 lines (33 loc) · 1.23 KB
/
UserCreate.test.js
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
import React from 'react'
import UserCreate, { SIGNUP_MUTATION } from './UserCreate'
import { mountMockedProvider } from '../../support/tests/mountMockedProvider'
describe('<UserCreate />', () => {
let result, userCreateWrapper
beforeEach(async () => {
result = {
signup: {
token: '234343345435ascsdaewrewwr3242',
user: {
username: 'awesome_user',
avatarUrl: 'http://avatar.url'
}
}
}
userCreateWrapper = await mountMockedProvider(result, SIGNUP_MUTATION, <UserCreate />)
})
it('has form component to submit the form', () => {
expect(userCreateWrapper.find('form')).toHaveLength(1)
})
it('has an input to upload the avatar for the profile', () => {
expect(userCreateWrapper.find('#upload-avatar')).toHaveLength(1)
})
it('has an input field to fill in the username', () => {
expect(userCreateWrapper.find("input[name='username']")).toHaveLength(1)
})
it('has an input field to fill in the email', () => {
expect(userCreateWrapper.find("input[type='email']")).toHaveLength(1)
})
it('has an input field to fill in the password and password confirmation', () => {
expect(userCreateWrapper.find("input[type='password']")).toHaveLength(2)
})
})