Quote machine, why is author treated diferently than the quote

Passing 11 out of 12,
not sure why the author would fail, while the quote is passing… they are nearly identical in functionality.

live demo, be sure to use the NavBar to get to quote


import React, { Component, Fragment } from 'react';
import { Card, Button, ButtonGroup } from 'react-bootstrap';
import PropTypes from 'prop-types';

export class Quote extends Component {

  constructor(props) {

    // Initial State
    this.state = {
      author: "Douglas Adams",
      source: "So Long, and Thanks for All the Fish",
      quote: "And as he drove on, the rainclouds dragged down the sky after him, for, though he did not know it, Rob McKenna was a Rain God. All he knew was that his working days were miserable and he had a succession of lousy holidays. All the clouds knew was that they loved him and wanted to be near him, to cherish him, and to water him.",

  // Quote.propTypes = {
  // this.propTypes = {
  static propTypes = {
    quote: PropTypes.string.isRequired,
    source: PropTypes.string.isRequired,
    author: PropTypes.string.isRequired

  setQuote = () => {
      author: "Obiwan Kenobi",
      source: "Return of the Jedi",
      quote: "Many of the turths we cling to..",



  render() {
    return (

        <Card bg="dark" style={{ width: '90%' }} id="quote-box">

                rel="noopener noreferrer"
                title=" Random Quote Machine"
                <i className="fas fa-quote-left"></i> Random Quote Machine <i className="fas fa-quote-right"></i>

            {/* Random Quote */}

            <blockquote className="blockquote mb-0">
              <p id="text">
                {' '}
                {' '}
              <footer className="blockquote-footer">
                <h3 id="author">
                <cite title="Source Title">{this.state.source}</cite>
            <ButtonGroup aria-label="Basic example" style={{ width: '20%' }}>
              <Button variant="primary" id="new-quote" onClick={this.setQuote}>new quote</Button>

              <Button as="a" variant="primary" id="tweet-quote" href="twitter.com/intent/tweet" ><i className="fab fa-twitter"></i></Button>

            rel="noopener noreferrer"
            title="This Episode on Twitch I build a template for my freeCodeCamp projects, with FontAwesome & Analytics"
            <i className="fab fa-twitch"></i> These Episodes on Twitch <i className="fab fa-twitch"></i>

export default Quote;

Did you try using an actual array of quote objects and not just one for the initial state and one other for the click handler?

I noticed that your random quote button works only once so in case of test-cases that one change happen for test case number 8 and for next testcase your quote does not change due to which it fails.
You can use https://api.quotable.io/random API to get rendom quotes.

1 Like

ok, that makes sense… I didn’t realize it was making a separate call for each test, thank you