Advertisement
Guest User

Untitled

a guest
Sep 2nd, 2016
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. describe('Component Type and Props', function () {
  2.  
  3. it('should be a stateless component', ()=>{
  4. expect(Login.prototype).toNotBeA(React.Component);
  5. });
  6.  
  7. it('should have the correct props defined', ()=>{
  8. var propTypes = {
  9. username: PropTypes.string,
  10. password: PropTypes.string,
  11. isValid: PropTypes.bool,
  12. isWaiting: PropTypes.bool,
  13. error: PropTypes.object,
  14. onSignIn: PropTypes.func.isRequired,
  15. onChange: PropTypes.func.isRequired
  16. };
  17. expect(Login.propTypes).toEqual(propTypes);
  18. //necesitamos comparar estricto porque si no cualquier PropType == PropType
  19. Object.keys(propTypes).forEach(
  20. (key)=>expect(propTypes[key]).toBe(Login.propTypes[key])
  21. );
  22. });
  23.  
  24. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement