Last active
April 8, 2016 21:44
-
-
Save zxqx/732b7290309894aec313 to your computer and use it in GitHub Desktop.
unit-test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ------------------------------------------ | |
// square-number.js | |
// ------------------------------------------ | |
module.exports = squareNumber; | |
function squareNumber(number) | |
{ | |
return number * number; | |
} | |
// ------------------------------------------ | |
// test.js | |
// ------------------------------------------ | |
const test = require('tape'); | |
const squareNumber = require('../square-number.js'); | |
test('squares numbers', function(t) { | |
t.plan(3); | |
t.equals(squareNumber(5), 25); | |
t.equals(squareNumber(12), 144); | |
t.equals(squareNumber(0), 0); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment