Instructions don't match tests


Check this one out please, the instructions don’t match the tests. One is telling you to make a button appear or not, the other is telling you to change the innerText of a button. I think this needs to be improved, it’s written quite terribly.

The tests should resemble the way your software is used.
In this case the instructions are implementation details, but the tests are testing functionality. The user don’t care if you’re swapping buttons or just changing button’s title, the final result should be the same.

By not testing implementation, you can easily refactor your code and not change a single test.

For example, this code will pass:

const inputStyle = {
  width: 235,
  margin: 5
};

class CheckUserAge extends React.Component {
  constructor(props) {
    super(props);
    // Change code below this line
    this.state = {
      userAge: "",
      input: ""
    };
    // Change code above this line
    this.submit = this.submit.bind(this);
    this.handleChange = this.handleChange.bind(this);
  }
  handleChange(e) {
    this.setState({
      input: e.target.value,
      userAge: ""
    });
  }
  submit() {
    this.setState((state) => ({
      userAge: state.input
    }));
  }
  render() {
    return (
      <div>
        <h3>Enter Your Age to Continue</h3>
        <input
          style={inputStyle}
          type="number"
          value={this.state.input}
          onChange={this.handleChange}
        />
        <br />
        {/* Change code below this line */}
        <button onClick={this.submit}>
          {!this.state.userAge
            ? "Submit"
            : this.state.userAge >= 18
            ? "You May Enter"
            : "You Shall Not Pass"}
        </button>
        {/* Change code above this line */}
      </div>
    );
  }
}

And if FCC would use React >= 16.8, then you could even write the solution using hooks and all the tests should still pass. If they don’t, you’ve been testing implementation (e.g. test #2 looks questionable and #7 is definitely testing implementation).