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

Creating a new testing structure #13

Merged
merged 2 commits into from
Aug 7, 2018
Merged

Conversation

makinde
Copy link

@makinde makinde commented Jun 22, 2018

This diff does a couple things:

  • It creates test file for every Model and Document method that we'll need to handle and test. These can be gradually filled in.
  • It breaks helpers.js functions into separate files. Each one of those now has a corresponding test file.

In upcoming diffs, I'll move the existing tests into this new structure.

This diff does a couple things:
- It creates test file for every Model and Document method that we'll need to handle and test. These can be gradually filled in.
- It breaks helpers.js functions into separate files. Each one of those now has a corresponding test file.

In upcoming diffs, I'll move the existing tests into this new structure.
@makinde makinde requested a review from brysgo June 22, 2018 05:11
@brysgo
Copy link
Collaborator

brysgo commented Jun 23, 2018

Haven't been able to look at it in depth, but I'm a fan of the new structure.

Copy link
Collaborator

@brysgo brysgo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried running the tests, and they pass despite an unhandled promise rejection.

✔ sanitizeDocumentList
✔ getUpdatePaths

index.test.js
(node:87895) UnhandledPromiseRejectionWarning: MongoError: ns not found
    at /Users/goldstein bryan/workspace/mongoose-authz/node_modules/mongoose/node_modules/mongodb-core/lib/connection/pool.js:593:63
    at authenticateStragglers (/Users/goldstein bryan/workspace/mongoose-authz/node_modules/mongoose/node_modules/mongodb-core/lib/connection/pool.js:516:16)
    at Connection.messageHandler (/Users/goldstein bryan/workspace/mongoose-authz/node_modules/mongoose/node_modules/mongodb-core/lib/connection/pool.js:552:5)
    at emitMessageHandler (/Users/goldstein bryan/workspace/mongoose-authz/node_modules/mongoose/node_modules/mongodb-core/lib/connection/connection.js:309:10)
    at Socket.<anonymous> (/Users/goldstein bryan/workspace/mongoose-authz/node_modules/mongoose/node_modules/mongodb-core/lib/connection/connection.js:452:17)
    at Socket.emit (events.js:180:13)
    at Socket.emit (domain.js:422:20)
    at addChunk (_stream_readable.js:274:12)
    at readableAddChunk (_stream_readable.js:261:11)
    at Socket.Readable.push (_stream_readable.js:218:10)
    at TCP.onread (net.js:581:20)
(node:87895) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 5)
(node:87895) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
✔ Disable - find
✔ Disable - remove

@makinde
Copy link
Author

makinde commented Aug 7, 2018

Ah, it looks like that error happens when the code drops a collection that's not there. I'm not sure why that's happening since the await mongoose.connection.collections.newusers.drop(); line is within a try/catch. That said, I'm going to create an issue for this that should be resolved when I migrate index.tests.js to the new test structure.

@makinde
Copy link
Author

makinde commented Aug 7, 2018

#16

@makinde makinde merged commit 494de59 into devcolor:master Aug 7, 2018
@makinde makinde deleted the todo_for_tests branch August 7, 2018 21:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants