@@ -5,14 +5,7 @@ import { expect } from 'chai';
5
5
import * as mongodb from '../../src/index' ;
6
6
import { setDifference } from '../mongodb' ;
7
7
8
- /**
9
- * TS-NODE Adds these keys but they are undefined, they are not present when you import from lib
10
- * We did not think this strangeness was worth investigating so we just make sure they remain set to undefined
11
- */
12
- const TS_NODE_EXPORTS = [ 'AnyBulkWriteOperation' , 'BulkWriteOptions' ] ;
13
-
14
8
const EXPECTED_EXPORTS = [
15
- ...TS_NODE_EXPORTS ,
16
9
'AbstractCursor' ,
17
10
'Admin' ,
18
11
'AggregationCursor' ,
@@ -31,11 +24,11 @@ const EXPECTED_EXPORTS = [
31
24
'ClientSession' ,
32
25
'Code' ,
33
26
'Collection' ,
34
- 'configureExplicitResourceManagement' ,
35
27
'CommandFailedEvent' ,
36
28
'CommandStartedEvent' ,
37
29
'CommandSucceededEvent' ,
38
30
'Compressor' ,
31
+ 'configureExplicitResourceManagement' ,
39
32
'ConnectionCheckedInEvent' ,
40
33
'ConnectionCheckedOutEvent' ,
41
34
'ConnectionCheckOutFailedEvent' ,
@@ -49,12 +42,13 @@ const EXPECTED_EXPORTS = [
49
42
'ConnectionPoolReadyEvent' ,
50
43
'ConnectionReadyEvent' ,
51
44
'CURSOR_FLAGS' ,
45
+ 'CursorTimeoutMode' ,
52
46
'Db' ,
53
47
'DBRef' ,
54
48
'Decimal128' ,
55
49
'Double' ,
56
- 'ExplainVerbosity' ,
57
50
'ExplainableCursor' ,
51
+ 'ExplainVerbosity' ,
58
52
'FindCursor' ,
59
53
'GridFSBucket' ,
60
54
'GridFSBucketReadStream' ,
@@ -102,6 +96,7 @@ const EXPECTED_EXPORTS = [
102
96
'MongoNetworkTimeoutError' ,
103
97
'MongoNotConnectedError' ,
104
98
'MongoOIDCError' ,
99
+ 'MongoOperationTimeoutError' ,
105
100
'MongoParseError' ,
106
101
'MongoRuntimeError' ,
107
102
'MongoServerClosedError' ,
@@ -111,10 +106,8 @@ const EXPECTED_EXPORTS = [
111
106
'MongoTailableCursorError' ,
112
107
'MongoTopologyClosedError' ,
113
108
'MongoTransactionError' ,
114
- 'MongoOperationTimeoutError' ,
115
109
'MongoUnexpectedServerResponseError' ,
116
110
'MongoWriteConcernError' ,
117
- 'WriteConcernErrorResult' ,
118
111
'ObjectId' ,
119
112
'OrderedBulkOperation' ,
120
113
'ProfilingLevel' ,
@@ -130,6 +123,10 @@ const EXPECTED_EXPORTS = [
130
123
'ServerHeartbeatStartedEvent' ,
131
124
'ServerHeartbeatSucceededEvent' ,
132
125
'ServerOpeningEvent' ,
126
+ 'ServerSelectionEvent' ,
127
+ 'ServerSelectionFailedEvent' ,
128
+ 'ServerSelectionStartedEvent' ,
129
+ 'ServerSelectionSucceededEvent' ,
133
130
'ServerType' ,
134
131
'SrvPollingEvent' ,
135
132
'Timestamp' ,
@@ -139,12 +136,9 @@ const EXPECTED_EXPORTS = [
139
136
'TopologyType' ,
140
137
'UnorderedBulkOperation' ,
141
138
'UUID' ,
139
+ 'WaitingForSuitableServerEvent' ,
142
140
'WriteConcern' ,
143
- 'ServerSelectionEvent' ,
144
- 'ServerSelectionFailedEvent' ,
145
- 'ServerSelectionStartedEvent' ,
146
- 'ServerSelectionSucceededEvent' ,
147
- 'WaitingForSuitableServerEvent'
141
+ 'WriteConcernErrorResult'
148
142
] ;
149
143
150
144
describe ( 'mongodb entrypoint' , ( ) => {
@@ -155,12 +149,4 @@ describe('mongodb entrypoint', () => {
155
149
it ( 'exports only the expected keys' , ( ) => {
156
150
expect ( setDifference ( Object . keys ( mongodb ) , EXPECTED_EXPORTS ) ) . to . be . empty ;
157
151
} ) ;
158
-
159
- it ( 'should export keys added by ts-node as undefined' , ( ) => {
160
- // If the array is empty, this test would be a no-op so we should remove it
161
- expect ( TS_NODE_EXPORTS ) . to . have . length . greaterThan ( 0 ) ;
162
- for ( const tsNodeExportKey of TS_NODE_EXPORTS ) {
163
- expect ( mongodb ) . to . have . property ( tsNodeExportKey , undefined ) ;
164
- }
165
- } ) ;
166
152
} ) ;
0 commit comments