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

Jest unit test fails #59

Closed
praveen-jha-by opened this issue Jan 12, 2021 · 1 comment · Fixed by #81
Closed

Jest unit test fails #59

praveen-jha-by opened this issue Jan 12, 2021 · 1 comment · Fixed by #81
Assignees
Labels
🐞 Bug Something isn't working Fix 👉 Fix

Comments

@praveen-jha-by
Copy link

Describe the Bug

yarn test or "npm run test" fails connect method of mongoose cannot be mocked.
As a result all of the test cases fail.

Version to Reproduce

Steps to Reproduce

npm install -g typescript-express-starter
npx typescript-express-starter nodeExpressTsSample
npm run test

Expected Behavior

The test cases should pass.

Actual Behavior

Test cases fail with error:
TypeError: Cannot read property 'then' of undefined
mongoose_1.connect(database_1.dbConnection.url, database_1.dbConnection.options)
.then(() => {
^
logger_1.logger.info('🟢 The database is connected.');

If applicable, add screenshots to help explain your problem. -->

Additional Context

Capture screen

image

@praveen-jha-by praveen-jha-by added the 🐞 Bug Something isn't working label Jan 12, 2021
@ljlm0402 ljlm0402 added the Fix 👉 Fix label Jan 21, 2021
@ljlm0402
Copy link
Owner

@praveen-jha-by

Thanks for the good Issues.
This is currently under review, and if you use the async/await syntax, it will work normally.

This was linked to pull requests Apr 18, 2021
This was unlinked from pull requests Apr 18, 2021
@ljlm0402 ljlm0402 linked a pull request Apr 18, 2021 that will close this issue
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐞 Bug Something isn't working Fix 👉 Fix
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants