Skip to content

Commit

Permalink
Properly expose express server to close its connection
Browse files Browse the repository at this point in the history
  • Loading branch information
elboletaire committed Nov 15, 2018
1 parent 24c6c7f commit 68be252
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/app.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import request from 'supertest'
import SwitchBoardOperator from './app'

afterAll(() => {
SwitchBoardOperator.app.close();
SwitchBoardOperator.server.close();
})

describe('main app', () => {
Expand Down
3 changes: 2 additions & 1 deletion src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class SwitchBoardOperator {
topology: Topology
rabbotClient: any
public app: any
public server: any

constructor() {
this.mergedConfig = Object.assign(config.get('topology'), {
Expand Down Expand Up @@ -69,7 +70,7 @@ class SwitchBoardOperator {
})
})

app.listen(3000, () => {
this.server = app.listen(3000, () => {
logger.info('SwitchBoard Operator listening on port 3000!')
})

Expand Down

0 comments on commit 68be252

Please sign in to comment.