From 6e47e847f24f1430e25b96ccaef634ad26dc166f Mon Sep 17 00:00:00 2001 From: Tom Russell Date: Wed, 8 Aug 2018 09:08:17 +0100 Subject: [PATCH] Setup mocha for apiserver testing --- apiserver/package.json | 5 ++++- apiserver/test/test.js | 12 ++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 apiserver/test/test.js diff --git a/apiserver/package.json b/apiserver/package.json index b1ec7fa3..1e902dc2 100644 --- a/apiserver/package.json +++ b/apiserver/package.json @@ -4,12 +4,15 @@ "description": "Serve API queries", "private": true, "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" + "test": "mocha" }, "author": "Tom Russell", "license": "GPL-3.0", "dependencies": { "express": "^4.16.3", "pg": "^7.4.3" + }, + "devDependencies": { + "mocha": "^5.2.0" } } diff --git a/apiserver/test/test.js b/apiserver/test/test.js new file mode 100644 index 00000000..a25a8e30 --- /dev/null +++ b/apiserver/test/test.js @@ -0,0 +1,12 @@ +/** + * Demo test + */ +const assert = require('assert'); + +describe('Array', function() { + describe('#indexOf()', function() { + it('should return -1 when the value is not present', function() { + assert.equal([1,2,3].indexOf(4), -1); + }); + }); +});