`findHighestPointWord()` Tests

by lionelrowe

HTML

<link rel="stylesheet" href="https://code.jquery.com/qunit/qunit-2.4.0.css">
<script src="https://code.jquery.com/qunit/qunit-2.4.0.js"></script>
  <div id="qunit"></div>
  <div id="qunit-fixture"></div>

JavaScript

function findHighestPointWord(sentence) {

	/* Your code here */

}



const tests = [

	['peanut butter jelly time', 'butter'],
  ['the quick brown fox jumps over the lazy dog', 'jumps'],
  ['to infinity and beyond', 'infinity'],
  ['hello world', 'world'],
  
  // and now for some edge cases...
  
  ['aaaaa e', 'aaaaa'], // same value but it appears first in the string
  ['e aaaaa', 'e'], // same
  ['ABC cba', 'ABC'], // same
  ['mIxed CASE', 'mIxed'] // should be case insensitive

];

	QUnit.test('`findHighestPointWord()` tests', function(assert) {
  for (let i = 0; i < tests.length; i++) {
  	assert.strictEqual(findHighestPointWord(tests[i][0]), tests[i][1], `${tests[i][0]} => ${tests[i][1]}`);
    }
  });