mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2026-01-13 06:32:39 +00:00
Split off app into own file
This commit is contained in:
@@ -1,12 +1,16 @@
|
||||
const should = require('chai').use(require('chai-as-promised')).should();
|
||||
const testing = require('./test.init.js');
|
||||
const request = require('supertest-as-promised');
|
||||
const app = require('../server.js');
|
||||
|
||||
const app = require('app.js');
|
||||
const BrewDB = require('db.js');
|
||||
|
||||
|
||||
const apiPath = '/api/brew';
|
||||
describe('/api/brew', () => {
|
||||
const apiPath = '/api/brew';
|
||||
|
||||
|
||||
describe(apiPath, () => {
|
||||
before('Await DB', ()=>{
|
||||
return BrewDB.connect()
|
||||
});
|
||||
|
||||
describe('POST', () => {
|
||||
it('creates a new brew', () => {
|
||||
@@ -18,7 +22,7 @@ describe(apiPath, () => {
|
||||
.expect(200)
|
||||
.then((res) => {
|
||||
const brew = res.body;
|
||||
should.exist(brew);
|
||||
//should.exist(brew);
|
||||
brew.should.have.property('editId').that.is.a('string');
|
||||
brew.should.have.property('shareId').that.is.a('string');
|
||||
brew.should.have.property('text').that.is.a('string');
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
const should = require('chai').use(require('chai-as-promised')).should();
|
||||
const testing = require('./test.init.js');
|
||||
|
||||
const BrewDB = require('../server/db.js');
|
||||
const BrewData = require('../server/brew.data.js');
|
||||
const BrewDB = require('db.js');
|
||||
const BrewData = require('brew.data.js');
|
||||
|
||||
|
||||
describe('BrewDB', () => {
|
||||
before('Await DB', ()=>{
|
||||
return BrewDB.connect().catch()
|
||||
return BrewDB.connect()
|
||||
});
|
||||
|
||||
it('generates ID on save', () => {
|
||||
return BrewData.create({
|
||||
text : "Brew Text"
|
||||
}).then((brew) => {
|
||||
should.exist(brew);
|
||||
//should.exist(brew);
|
||||
brew.should.have.property('editId').that.is.a('string');
|
||||
brew.should.have.property('shareId').that.is.a('string');
|
||||
brew.should.have.property('text').that.is.a('string');
|
||||
|
||||
@@ -1,23 +1,9 @@
|
||||
require('app-module-path').addPath('./server');
|
||||
|
||||
|
||||
// initialize config
|
||||
const config = require('nconf')
|
||||
.argv()
|
||||
.env({ lowerCase: true })
|
||||
.file('testing', { file: `./config/testing.json` })
|
||||
.file('environment', { file: `../config/${process.env.NODE_ENV}.json` })
|
||||
.file('defaults', { file: '../config/default.json' });
|
||||
|
||||
const should = require('chai').use(require('chai-as-promised')).should();
|
||||
|
||||
const log = require('loglevel');
|
||||
log.setLevel('trace');
|
||||
|
||||
module.exports = {
|
||||
config: config,
|
||||
should: should,
|
||||
clearCache: () => {
|
||||
return new Promise((resolve, reject) => {
|
||||
return resolve();
|
||||
});
|
||||
},
|
||||
should: should
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user