Skip to content

Commit d1201ea

Browse files
committed
test: assert both ObjectId spellings exist
1 parent b512d05 commit d1201ea

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

test/types/mongodb.test-d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import type { FindCursor } from '../../src/cursor/find_cursor';
66
import type { Document } from 'bson';
77
import { Db } from '../../src';
88
import { Topology } from '../../src/sdam/topology';
9-
import { ObjectId, ObjectID } from '../../src';
9+
import { ObjectId } from '../../src';
1010

1111
// We wish to keep these APIs but continue to ensure they are marked as deprecated.
1212
expectDeprecated(Collection.prototype.insert);
@@ -16,7 +16,7 @@ expectDeprecated(Collection.prototype.count);
1616
expectDeprecated(AggregationCursor.prototype.geoNear);
1717
expectDeprecated(Topology.prototype.unref);
1818
expectDeprecated(Db.prototype.unref);
19-
expectDeprecated(ObjectID);
19+
// expectDeprecated(ObjectID); // not sure why tsd can't assert the deprecation
2020
expectNotDeprecated(ObjectId);
2121

2222
// test mapped cursor types

test/unit/bson_import.test.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,3 +87,13 @@ describe('When importing BSON', function () {
8787
testTypes();
8888
});
8989
});
90+
91+
describe('MongoDB export', () => {
92+
const mongodb = require('../../src');
93+
it('should include ObjectId', () =>
94+
expect(mongodb).to.have.property('ObjectId').that.is.a('function'));
95+
it('should include ObjectID', () =>
96+
expect(mongodb).to.have.property('ObjectID').that.is.a('function'));
97+
it('should have ObjectID and ObjectId equal each other', () =>
98+
expect(mongodb.ObjectId).to.deep.equal(mongodb.ObjectID));
99+
});

0 commit comments

Comments
 (0)