Advertisement
Guest User

Untitled

a guest
Jun 25th, 2019
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.05 KB | None | 0 0
  1. let props = {
  2. actions: mockProps.actions,
  3. auth: {
  4. isAuthenticated: false,
  5. isFetching: false
  6. },
  7. history: mockProps.history,
  8. location: {
  9. pathname: "/login",
  10. search: "",
  11. hash: "",
  12. key: "0m32x8"
  13. },
  14. match: mockProps.match
  15. }
  16.  
  17. // Working Shallow Rendered Test
  18. it('componentWillReceiveProps', () => {
  19. const componentWillReceivePropsSpy = jest.spyOn(Login.prototype, 'componentWillReceiveProps')
  20. shallowWrapper.setProps({ location: { search: "testing" } })
  21. expect(componentWillReceivePropsSpy).toHaveBeenCalled()
  22. })
  23.  
  24. // Broken Mount Rendered Test
  25. it('Mount Test', () => {
  26. mount(<Provider store={store}><Login {...props}/></Provider>)
  27. })
  28.  
  29. state = {
  30. shouldRedirect: false,
  31. errorShown: false,
  32. fields: {
  33. username: '',
  34. password: ''
  35. },
  36. token: q.parse(this.props.location.search).token,
  37. fieldErrors: {}
  38. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement