-
-
Save erkantaylan/043763ba41c6062424f3 to your computer and use it in GitHub Desktop.
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
//silly.js | |
function sumNumbers(a, b){ | |
return a+b; | |
} | |
function sumNumbersAsync(a, b, callback){ | |
var result = a + b; | |
callback(result); | |
} | |
exports.sumNumbers = sumNumbers; | |
exports.sumNumbersAsync = sumNumbersAsync; | |
//test-main.js | |
var silly = require("./silly"); | |
exports["test main"] = function(assert) { | |
var result = silly.sumNumbers(1,2); | |
assert.pass(result == 3, "Unit test running!"); | |
assert.equal(result, 3, "Second unit test running!"); | |
assert.notEqual(result, 4, "Third unit test running!"); | |
}; | |
exports["test main async"] = function(assert, done) { | |
silly.sumNumbersAsync(1, 2, function(result){ | |
assert.pass(result == 3, "Unit test running! ASYNC"); | |
assert.equal(result, 3, "Second unit test running! ASYNC"); | |
assert.notEqual(result, 3, "Third unit test running! ASYNC"); | |
done(); | |
}) | |
}; | |
require("sdk/test").run(exports); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment