-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
Showing
6 changed files
with
195 additions
and
2 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import { expect } from 'chai'; | ||
|
||
import { | ||
Admin, | ||
AggregationCursor, | ||
ChangeStream, | ||
ClientSession, | ||
Collection, | ||
Db, | ||
FindCursor, | ||
GridFSBucket, | ||
GridFSBucketWriteStream, | ||
ListCollectionsCursor, | ||
ListIndexesCursor, | ||
MongoClient, | ||
OrderedBulkOperation, | ||
UnorderedBulkOperation | ||
} from '../../mongodb'; | ||
|
||
const classesWithAsyncAPIs = new Map<string, any>([ | ||
['Admin', Admin], | ||
['FindCursor', FindCursor], | ||
['ListCollectionsCursor', ListCollectionsCursor], | ||
['ListIndexesCursor', ListIndexesCursor], | ||
['AggregationCursor', AggregationCursor], | ||
['ChangeStream', ChangeStream], | ||
['Collection', Collection], | ||
['Db', Db], | ||
['GridFSBucket', GridFSBucket], | ||
['ClientSession', ClientSession], | ||
['GridFSBucketWriteStream', GridFSBucketWriteStream], | ||
['OrderedBulkOperation', OrderedBulkOperation], | ||
['UnorderedBulkOperation', UnorderedBulkOperation] | ||
]); | ||
|
||
describe('mongodb-legacy', () => { | ||
for (const [className, ctor] of classesWithAsyncAPIs) { | ||
it(`test suite imports a ${className} with the legacy symbol`, () => { | ||
// Just confirming that the mongodb-legacy import is correctly overriding the local copies | ||
// of these classes from "src". See test/mongodb.ts for more. | ||
expect(ctor.prototype).to.have.property(Symbol.for('@@mdb.callbacks.toLegacy')); | ||
}); | ||
} | ||
it('test suite imports a LegacyMongoClient as MongoClient', () => { | ||
// Just confirming that the mongodb-legacy import is correctly overriding the local copy | ||
// of MongoClient from "src". See test/mongodb.ts for more. | ||
expect(MongoClient).to.have.property('name', 'LegacyMongoClient'); | ||
}); | ||
}); |