-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
fix(NODE-3574): reintroduce ObjectID export #2965
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure my suggested approach for tsd is the ideal one but it seems to work.
test/types/mongodb.test-d.ts
Outdated
@@ -15,6 +16,8 @@ expectDeprecated(Collection.prototype.count); | |||
expectDeprecated(AggregationCursor.prototype.geoNear); | |||
expectDeprecated(Topology.prototype.unref); | |||
expectDeprecated(Db.prototype.unref); | |||
// expectDeprecated(ObjectID); // not sure why tsd can't assert the deprecation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is because it's root level. I tried this out and it worked:
import * as AllExports from '../../src';
expectDeprecated(AllExports.ObjectID);
expectNotDeprecated(AllExports.ObjectId);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perfect, that works!
test/unit/bson_import.test.js
Outdated
it('should include ObjectID', () => | ||
expect(mongodb).to.have.property('ObjectID').that.is.a('function')); | ||
it('should have ObjectID and ObjectId equal each other', () => | ||
expect(mongodb.ObjectId).to.deep.equal(mongodb.ObjectID)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be just regular equal since we're actually expecting reference equality?
expect(mongodb.ObjectId).to.deep.equal(mongodb.ObjectID)); | |
expect(mongodb.ObjectId).to.equal(mongodb.ObjectID)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, I don't think there should be any package lock changes for this PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lock file changes fixed, and no longer checking deep equality 🚀
4be2865
to
8c2792c
Compare
Reintroduced the capitalized ObjectID export along with a deprecation tag.