title: How do I get this terminal app to pass node test?
body: <p>So this is a small terminal game, rock paper scissors, and I need help writing the remaining code so that it can pass my node tests. I have been able to code and input a decision for hand1 and hand2 and get a result displaying who won, but it won't seem to pass the node tests when I run them.</p>
  
  <p>The node test detects the "tie" as correct, but doesn't detect the hands won or the scrub input as correct, yet it all works when I use it in terminal. <a href="https://i.stack.imgur.com/8X2YQ.png" rel="nofollow noreferrer">Here's an image of what the node test is saying</a></p>
  
  <p>The code needing to be rewritten is within function rockPaperScissors(hand1, hand2) below</p>
  
  <pre><code>    'use strict';
  
  const assert = require('assert');
  const readline = require('readline');
  const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
  });
  
  
  function rockPaperScissors(hand1, hand2) {
  
    if (hand1 === hand2) {
      return "It's a tie!";
    } else if (hand1 === 'rock') {
      if (hand2 === 'paper') {
        return "Hand two wins!";
      } else if (hand2 === 'scissors') {
        return "Hand one wins!";
      } 
    }
  
    if (hand1 === 'paper') {
      if (hand2 === 'rock') {
        return "Hand one wins!";
      } else if (hand2 === 'scissors') {
        return "Hand two wins!";
      }
    }
  
    if (hand1 === 'scissors') {
      if (hand2 === 'paper') {
        return "Hand one wins!";
      } else if (hand2 === 'rock') {
        return "Hand two wins!";
      }
    }
  
  
  
  
  }
  
  
  
  
  
  
  
  
  
  
  
  function getPrompt() {
    rl.question('hand1: ', (answer1) =&gt; {
      rl.question('hand2: ', (answer2) =&gt; {
        console.log( rockPaperScissors(answer1, answer2) );
        getPrompt();
      });
    });
  }
  
  // Tests
  
  if (typeof describe === 'function') {
  
    describe('#rockPaperScissors()', () =&gt; {
      it('should detect a tie', () =&gt; {
        assert.equal(rockPaperScissors('rock', 'rock'), "It's a tie!");
        assert.equal(rockPaperScissors('paper', 'paper'), "It's a tie!");
        assert.equal(rockPaperScissors('scissors', 'scissors'), "It's a tie!");
      });
      it('should detect which hand won', () =&gt; {
        assert.equal(rockPaperScissors('rock', 'paper'), "Hand two wins!");
        assert.equal(rockPaperScissors('paper', 'scissors'), "Hand two wins!");
        assert.equal(rockPaperScissors('rock', 'scissors'), "Hand one wins!");
      });
      it('should scrub input to ensure lowercase with "trim"ed whitepace', () =&gt; {
        assert.equal(rockPaperScissors('rOcK', ' paper '), "Hand two wins!");
        assert.equal(rockPaperScissors('Paper', 'SCISSORS'), "Hand two wins!");
        assert.equal(rockPaperScissors('rock ', 'sCiSsOrs'), "Hand one wins!");
      });
    });
  } else {
  
    getPrompt();
  
  }
  </code></pre>