JSFiddle - React, Tailwind, and code Playground
HTML
<script src="http://code.jquery.com/qunit/qunit-1.10.0.js"></script>
<link rel="stylesheet" href="http://code.jquery.com/qunit/qunit-1.10.0.css">
<h1 id="qunit-header">QUnit Test Suite</h1>
<h2 id="qunit-banner"></h2>
<div id="qunit-testrunner-toolbar"></div>
<h2 id="qunit-userAgent"></h2>
<ol id="qunit-tests"></ol>
JavaScript
/*
* Source for Oven plugin for jQuery
*/
(function() {
/*
* isEven(n)
* @args number n
* @return boolean returns whether the given number is even
*/
jQuery.isEven = function(number) {
return number % 2 == 0;
};
/* isOdd(n)
* @args number n
* @return boolean returns whether the given number is odd
*/
jQuery.isOdd = function(number) {
return !jQuery.isEven(number);
};
})();
/**
* Module: isEven
*/
module("Module isEven tests");
test('isEven', function() {
QUnit.equal($.isEven(24), true, '24 is even');
QUnit.equal($.isEven(0), true, '0 is even');
QUnit.equal($.isEven(2441923), false, '2441923 is not even');
QUnit.equal($.isEven(-45), false, '-45 is not even');
QUnit.equal($.isEven({}), false, '{} is not a number');
QUnit.equal($.isEven(78.5), false, '78.5 is not even');
});
/**
* Module: isOdd
*/
module("Module isOdd tests");
test('isOdd()', function() {
QUnit.equal($.isOdd(24), false, '24 is not odd');
QUnit.equal($.isOdd(0), false, '0 is not odd');
QUnit.equal($.isOdd(2441923), true, '2441923 is odd');
QUnit.equal($.isOdd(-45), true, '-45 is odd');
QUnit.equal($.isOdd([]), false, '[] is not even a number. Comon?');
QUnit.equal($.isEven(189.23), false, '189.23 is not odd');
});