diff --git a/package.json b/package.json index 72b452d..b969653 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "license": "MIT", "repository": "juliangruber/node-core-test", "scripts": { - "test": "prettier-standard && standard" + "test": "prettier-standard && standard && node test" }, "devDependencies": { "prettier-standard": "^16.4.1", diff --git a/test.js b/test.js new file mode 100644 index 0000000..ca5a702 --- /dev/null +++ b/test.js @@ -0,0 +1,21 @@ +'use strict' + +const assert = require('assert') +const test = require('.') + +test('synchronous passing test', t => { + // This test passes because it does not throw an exception. + assert.strictEqual(1, 1) +}) + +test('asynchronous passing test', async t => { + // This test passes because the Promise returned by the async + // function is not rejected. + assert.strictEqual(1, 1) +}) + +test('callback passing test', (t, done) => { + // done() is the callback function. When the setImmediate() runs, it invokes + // done() with no arguments. + setImmediate(done) +})