Setup unit/integration testing with mocha

This commit is contained in:
Robert Schäfer 2018-11-20 23:31:58 +01:00
parent 0eab41b5ef
commit 0df58f00a1
3 changed files with 392 additions and 858 deletions

View File

@ -4,7 +4,7 @@
"description": "GraphQL Backend for Human Connection", "description": "GraphQL Backend for Human Connection",
"main": "src/index.js", "main": "src/index.js",
"scripts": { "scripts": {
"test": "echo \"Error: no test specified\" && exit 1", "test": "mocha --require @babel/register src/**/*.test.js",
"start": "./node_modules/.bin/nodemon --exec babel-node src/index.js", "start": "./node_modules/.bin/nodemon --exec babel-node src/index.js",
"start:debug": "./node_modules/.bin/nodemon --exec babel-node --inspect=0.0.0.0:9229 src/index.js", "start:debug": "./node_modules/.bin/nodemon --exec babel-node --inspect=0.0.0.0:9229 src/index.js",
"seedDb": "./node_modules/.bin/babel-node src/seed/seed-db.js" "seedDb": "./node_modules/.bin/babel-node src/seed/seed-db.js"
@ -46,7 +46,9 @@
"trunc-html": "^1.1.2" "trunc-html": "^1.1.2"
}, },
"devDependencies": { "devDependencies": {
"chai": "^4.2.0",
"faker": "^4.1.0", "faker": "^4.1.0",
"mocha": "^5.2.0",
"nodemon": "^1.18.4" "nodemon": "^1.18.4"
} }
} }

View File

@ -0,0 +1,21 @@
import { describe, it } from 'mocha'
import { expect } from 'chai'
describe('query', () => {
describe('statistics', () => {
describe('authenticated user', () => {
describe('read', () => {
it('is forbidden', () => {
})
})
})
context('admin', () => {
describe('read', () => {
it('is permitted', () => {
})
})
})
})
})

1225
yarn.lock

File diff suppressed because it is too large Load Diff