Guest User

Untitled

a guest
Mar 13th, 2018
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.06 KB | None | 0 0
  1. describe('signup form', () => {
  2. // [...]
  3. test('should display the usernameError next to username input if usernameError is passed in prop', () => {
  4. const wrapper = shallow(
  5. <SignupForm
  6. passwordConfirmation=""
  7. username=""
  8. email=""
  9. password=""
  10. submit={jest.fn()}
  11. usernameError="some error"
  12. />,
  13. );
  14. const usernameError = wrapper.find('input[name="username"] + p');
  15. expect(usernameError.length).toEqual(1);
  16. expect(usernameError.text()).toBe('some error');
  17. });
  18. test('should display the emailError next to email input if emailError is passed in prop', () => {
  19. const wrapper = shallow(
  20. <SignupForm
  21. passwordConfirmation=""
  22. username=""
  23. email=""
  24. password=""
  25. submit={jest.fn()}
  26. emailError="some error"
  27. />,
  28. );
  29. const emailError = wrapper.find('input[name="email"] + p');
  30. expect(emailError.length).toEqual(1);
  31. expect(emailError.text()).toBe('some error');
  32. });
  33. test('should display the passwordError next to password input if passwordError is passed in prop', () => {
  34. const wrapper = shallow(
  35. <SignupForm
  36. passwordConfirmation=""
  37. username=""
  38. email=""
  39. password=""
  40. submit={jest.fn()}
  41. passwordError="some error"
  42. />,
  43. );
  44. const passwordError = wrapper.find('input[name="password"] + p');
  45. expect(passwordError.length).toEqual(1);
  46. expect(passwordError.text()).toBe('some error');
  47. });
  48. test('should display the passwordConfirmationError next to passwordConfirmation input if passwordConfirmationError is passed in prop', () => {
  49. const wrapper = shallow(
  50. <SignupForm
  51. passwordConfirmation=""
  52. username=""
  53. email=""
  54. password=""
  55. submit={jest.fn()}
  56. passwordConfirmationError="some error"
  57. />,
  58. );
  59. const passwordConfirmationError = wrapper.find('input[name="passwordConfirmation"] + p');
  60. expect(passwordConfirmationError.length).toEqual(1);
  61. expect(passwordConfirmationError.text()).toBe('some error');
  62. });
  63. });
Add Comment
Please, Sign In to add comment