Unit Testing Example
Contains the Time class and bdd unit tests.
by nate
HTML
<script src="//cdnjs.cloudflare.com/ajax/libs/mocha/1.20.1/mocha.js"></script>
<link rel="stylesheet" href=" //cdnjs.cloudflare.com/ajax/libs/mocha/1.20.1/mocha.css">
<script src="//cdnjs.cloudflare.com/ajax/libs/chai/1.9.1/chai.min.js"></script>
<div id="mocha"></div>
JavaScript
/**
* Write a reverseWords function that accepts a string as a parameter, and
* reverses each word in the string. Any spaces in the string should be retained.
*
* Example:
* reverseWords("This is an example!"); // returns "sihT si na !elpmaxe"
*/
function reverseWords(str) {
}
// Tests
mocha.setup('bdd');
const assert = chai.assert;
describe('Fixed Tests', function () {
it('Tests', function() {
assert.equal(reverseWords('The quick brown fox jumps over the lazy dog.'), 'ehT kciuq nworb xof spmuj revo eht yzal .god');
});
});
mocha.run();