From ffe6e8e17671ffb11acf39320aa10ffa7804b9a2 Mon Sep 17 00:00:00 2001 From: Julian Gruber Date: Wed, 23 Mar 2022 21:46:57 +0100 Subject: [PATCH] add basic passing test --- package.json | 2 +- test.js | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 test.js 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) +})