MyComponent.defaultProps = { location: 'San Francisco' } , ha definido un prop de ubicación que se establece en la cadena San Francisco , a menos que especifique lo contrario. React asigna props por defecto si los prop no están definidos, pero si pasa null como valor para un prop, seguirá siendo null . ShoppingCart . Defina accesorios predeterminados en este componente que especifican items prop con un valor de 0 . ShoppingCart debe renderizar.
testString: 'assert((function() { const mockedComponent = Enzyme.mount(React.createElement(ShoppingCart)); return mockedComponent.find("ShoppingCart").length === 1; })(), "The ShoppingCart component should render.");'
- text: 'El componente ShoppingCart debe tener un prop predeterminado de { items: 0 } .'
testString: 'assert((function() { const mockedComponent = Enzyme.mount(React.createElement(ShoppingCart)); mockedComponent.setProps({items: undefined}); return mockedComponent.find("ShoppingCart").props().items === 0; })(), "The ShoppingCart component should have a default prop of { items: 0 }.");'
```