mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-29 21:13:43 -05:00
Merge pull request #3687 from overleaf/jpa-spd-mocks-init
Move app initialisation logic to separate file GitOrigin-RevId: 858d22b56a42bc1ab53fef54bc209daae4e0fb07
This commit is contained in:
parent
4a6af88760
commit
c6b0cd0127
2 changed files with 21 additions and 11 deletions
|
@ -1,6 +1,4 @@
|
|||
const App = require('../../../app.js')
|
||||
const MongoHelper = require('./helpers/MongoHelper')
|
||||
const { logger } = require('logger-sharelatex')
|
||||
require('./helpers/InitApp')
|
||||
|
||||
const MockAnalyticsApi = require('./mocks/MockAnalyticsApi')
|
||||
const MockChatApi = require('./mocks/MockChatApi')
|
||||
|
@ -15,10 +13,6 @@ const MockSpellingApi = require('./mocks/MockSpellingApi')
|
|||
const MockV1Api = require('./mocks/MockV1Api')
|
||||
const MockV1HistoryApi = require('./mocks/MockV1HistoryApi')
|
||||
|
||||
logger.level('error')
|
||||
|
||||
MongoHelper.initialize()
|
||||
|
||||
const mockOpts = {
|
||||
debug: ['1', 'true', 'TRUE'].includes(process.env.DEBUG_MOCKS)
|
||||
}
|
||||
|
@ -35,7 +29,3 @@ MockRecurlyApi.initialize(6034, mockOpts)
|
|||
MockSpellingApi.initialize(3005, mockOpts)
|
||||
MockV1Api.initialize(5000, mockOpts)
|
||||
MockV1HistoryApi.initialize(3100, mockOpts)
|
||||
|
||||
before(function(done) {
|
||||
App.listen(3000, 'localhost', done)
|
||||
})
|
||||
|
|
20
services/web/test/acceptance/src/helpers/InitApp.js
Normal file
20
services/web/test/acceptance/src/helpers/InitApp.js
Normal file
|
@ -0,0 +1,20 @@
|
|||
const App = require('../../../../app.js')
|
||||
const MongoHelper = require('./MongoHelper')
|
||||
const { logger } = require('logger-sharelatex')
|
||||
|
||||
logger.level('error')
|
||||
|
||||
MongoHelper.initialize()
|
||||
|
||||
let server
|
||||
|
||||
before('start main app', function(done) {
|
||||
server = App.listen(3000, 'localhost', done)
|
||||
})
|
||||
|
||||
after('stop main app', function(done) {
|
||||
if (!server) {
|
||||
return done()
|
||||
}
|
||||
server.close(done)
|
||||
})
|
Loading…
Reference in a new issue