Skip to content

Instantly share code, notes, and snippets.

@hannahhch
Last active November 21, 2019 17:24
Show Gist options
  • Save hannahhch/e3bc2e1a9f2131c35735df301dee3cd9 to your computer and use it in GitHub Desktop.
Save hannahhch/e3bc2e1a9f2131c35735df301dee3cd9 to your computer and use it in GitHub Desktop.

round.js

class Round {
  constructor(deck) {
    this.deck = deck.cards;
    this.counter = 0;
    this.turn = turn;
    this.incorrectGuess = [];
    this.correctGuess = [];
  }
}

You did have this.turn = turn commented out, so I'm not sure if this was something you were trying to use. If so, we aren't passing in a "turn" to the constructor, like we are with deck so it is undefined. I don't think you need this.turn at all, since you are keeping track of the number of turns with your counter.

round-test.js

  it('should store correct guesses', function() {
    // const turn1 = new Turn('spleen', card2)
    // const turn2 = new Turn('appendix', card2);
    // const turn = new Turn('gallbladder', card2);
    const round = new Round(deck1);
    // round.takeTurn(turn1);
    // expect(round.correctGuess).to.deep.equal([]);
    // round.takeTurn('appendix');
    // expect(round.correctGuess).to.deep.equal([]);
    round.takeTurn('gallbladder');
    expect(round.correctGuess).to.deep.equal(['gallbladder']);
  });

For your failing test - take a look at what the correct answer is for deck1, card1 - make sure you're passing in the correctGuess.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment