chore: Setup ava and sinon test libraries

This commit is contained in:
Faruk AYDIN
2021-10-08 19:02:36 +02:00
committed by Ali BARIN
parent a0c34e9353
commit a39ae93ca4
4 changed files with 498 additions and 29 deletions

View File

@@ -1,7 +0,0 @@
'use strict';
const backend = require('..');
describe('backend', () => {
it('needs tests');
});

View File

@@ -6,7 +6,7 @@
"dev": "nodemon --watch 'src/**/*.ts' --exec 'ts-node' src/app.ts",
"build": "tsc",
"start": "node dist/index.js",
"test": "echo \"Error: run tests from root\" && exit 1",
"test": "ava",
"db:create": "ts-node ./bin/database/create.ts",
"db:drop": "ts-node ./bin/database/drop.ts",
"db:migration:create": "knex migrate:make",
@@ -56,7 +56,20 @@
"@types/morgan": "^1.9.3",
"@types/node": "^16.10.2",
"@types/pg": "^8.6.1",
"ava": "^3.15.0",
"nodemon": "^2.0.13",
"sinon": "^11.1.2",
"ts-node": "^10.2.1"
},
"ava": {
"files": [
"test/**/*"
],
"extensions": [
"ts"
],
"require": [
"ts-node/register"
]
}
}

View File

@@ -0,0 +1,7 @@
import test from 'ava';
const fn = () => 'foo';
test('fn() returns foo', t => {
t.is(fn(), 'foo');
});