Override Default Props testing

Override Default Props testing
0.0 0

#1

Tell us what’s happening:
I feel that I am completing this assignment correctly, but the test suite is not passing. The live display is updating with the value correctly.

Your code so far


const Items = (props) => {
  return <h1>Current Quantity of Items in Cart: {props.quantity}</h1>
}

Items.defaultProps = {
  quantity: 0
}

class ShoppingCart extends React.Component {
  constructor(props) {
    super(props);
  }
  render() {
    { /* change code below this line */ }
    return (
      <Items 
        quantity={10}
      />
    )
    { /* change code above this line */ }
  }
};

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.181 Safari/537.36.

Link to the challenge:
https://learn.freecodecamp.org/front-end-libraries/react/override-default-props


#2

Found the issue. Dug into the repo for the test suite and it’s including the test:

getUserInput(‘index’).replace(/ /g,’’).includes(’<Itemsquantity={10}/>’);

Meaning that it was not allowing my solution because I broke my return and props declarations into separate lines. This feels like an overly strict test.