Created
September 1, 2016 20:34
-
-
Save sminutoli/29c5fa060cee1c6d82f151f5949bb8ca to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
describe('Component Type and Props', function () { | |
it('should be a stateless component', ()=>{ | |
expect(Login.prototype).toNotBeA(React.Component); | |
}); | |
it('should have the correct props defined', ()=>{ | |
var propTypes = { | |
username: PropTypes.string, | |
password: PropTypes.string, | |
isValid: PropTypes.bool, | |
isWaiting: PropTypes.bool, | |
error: PropTypes.object, | |
onSignIn: PropTypes.func.isRequired, | |
onChange: PropTypes.func.isRequired | |
}; | |
expect(Login.propTypes).toEqual(propTypes); | |
//necesitamos comparar estricto porque si no cualquier PropType == PropType | |
Object.keys(propTypes).forEach( | |
(key)=>expect(propTypes[key]).toBe(Login.propTypes[key]) | |
); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment