Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

app.js is untestable #141

Closed
christian-hawk opened this issue Nov 13, 2020 · 0 comments · Fixed by #143
Closed

app.js is untestable #141

christian-hawk opened this issue Nov 13, 2020 · 0 comments · Fixed by #143

Comments

@christian-hawk
Copy link
Contributor

The server is always automatically started when:

const app = require('../server/app)

or

const app = rewire('../server/app.js)

For waiting the app to start, this event does the trick:

app.emit('appStarted') // event emitter for tests

But for unit-tests, we need to be able to test the app.js file without server starting.

The problem is that, right now,

Maybe we can use Factory design pattern to detach? Any thoughts @kdhttps @jgomer2001 ?

christian-hawk added a commit that referenced this issue Nov 16, 2020
app was untestable, so app-factory.js was created to ensure it can be tested.

closes #141
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant