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

Mockgoose calls mongoose.createConnection with incorrect arguments #89

Closed
viking opened this issue Sep 17, 2014 · 2 comments
Closed

Mockgoose calls mongoose.createConnection with incorrect arguments #89

viking opened this issue Sep 17, 2014 · 2 comments

Comments

@viking
Copy link

viking commented Sep 17, 2014

See:

var connection = mongoose.originalCreateConnection.call(mongoose, database, options, function (err) {

mongoose.createConnection requires the first argument to be either a hostname or a URI. Mockgoose is calling it with the database name as the first argument. This causes connection.host to return the database name instead of the host name.

This matters because I'm creating multiple connections based on mongoose.connection.host.

What are your thoughts?

@jesseclark
Copy link

I just noticed this issue myself.

I saw that the mock db object seemed at first to be using the uri I passed in to #connect() but then saw that the resulting db object has the host set to the database name part of the uri and the databaseName property is always 'test'.

In my tests I can stub the connect method and check that connect is called with the value I expect but this would be a nice to have.

@winfinit
Copy link
Collaborator

this should be resolved with 5.0 release

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

No branches or pull requests

3 participants