modify code to standard style

This commit is contained in:
Jay 2018-03-13 23:40:10 +08:00
parent d4f9e78e2a
commit 32916d269e
7 changed files with 14 additions and 14 deletions

3
app.js
View File

@ -1,15 +1,12 @@
const Koa = require('koa')
const app = new Koa()
const path = require('path')
const fs = require('fs')
const config = require('./config')
// require middleware
const cors = require('kcors')
const koaBody = require('koa-body')
const koaSession = require('koa-session2')
const koaLogger = require('koa-logger')
const koaMount = require('koa-mount')
const koaStatic = require('koa-static')
if (process.env['NODE_ENV'] !== 'test') {

View File

@ -6,6 +6,6 @@ module.exports = {
port: process.env.DB_PORT || 5432,
db: process.env.DB_NAME || 'mystorage',
user: process.env.DB_USER || 'postgres',
pass: process.env.DB_PASS || '',
pass: process.env.DB_PASS || ''
}
}

View File

@ -1,3 +1,3 @@
process.env.__BASE = __dirname
const server = require('./app')
require('./app')

View File

@ -5,7 +5,7 @@ r.use('/api', require('./api').routes())
r.get('/', async (c, n) => {
c.status = 200
c.body = ""
c.body = ''
})
module.exports = r

View File

@ -1,10 +1,12 @@
/* eslint-disable no-unused-vars */
/* eslint-disable no-undef */
/* eslint-disable no-unused-expressions */
it('api root test', done => {
chai.request(server)
.get('/api')
.end((err, res) => {
chai.expect(err).to.be.null
chai.expect(res).to.be.status(200)
chai.expect(res).to.have.status(200)
done()
})
})

View File

@ -1,3 +1,5 @@
/* eslint-disable no-undef */
/* eslint-disable no-unused-vars */
process.env['NODE_ENV'] = 'test'
global.chai = require('chai')
global.chaiHttp = require('chai-http')
@ -5,7 +7,6 @@ global.server = require('../app')
global.chai.use(chaiHttp)
global.importTest = (name, path) => {
describe(name, () => {
require(path)