|
1 | 1 | import { strict as assert } from 'assert'; |
2 | | -import { Document, Long, UUID } from 'bson'; |
| 2 | +import { type Document, Long, UUID } from 'bson'; |
3 | 3 | import { expect } from 'chai'; |
4 | 4 | import { on, once } from 'events'; |
5 | 5 | import { gte, lt } from 'semver'; |
6 | 6 | import * as sinon from 'sinon'; |
7 | 7 | import { PassThrough } from 'stream'; |
8 | 8 | import { setTimeout } from 'timers'; |
9 | 9 |
|
| 10 | +import { |
| 11 | + type ChangeStream, |
| 12 | + type ChangeStreamDocument, |
| 13 | + type ChangeStreamOptions, |
| 14 | + type ResumeToken |
| 15 | +} from '../../../src/change_stream'; |
| 16 | +import { type CommandStartedEvent } from '../../../src/cmap/command_monitoring_events'; |
| 17 | +import { type Collection } from '../../../src/collection'; |
| 18 | +import { LEGACY_HELLO_COMMAND } from '../../../src/constants'; |
| 19 | +import { type Db } from '../../../src/db'; |
| 20 | +import { MongoAPIError, MongoChangeStreamError, MongoServerError } from '../../../src/error'; |
| 21 | +import { type MongoClient } from '../../../src/mongo_client'; |
| 22 | +import { ReadPreference } from '../../../src/read_preference'; |
| 23 | +import { isHello } from '../../../src/utils'; |
10 | 24 | import * as mock from '../../tools/mongodb-mock/index'; |
11 | 25 | import { TestBuilder, UnifiedTestSuiteBuilder } from '../../tools/unified_suite_builder'; |
12 | 26 | import { type FailCommandFailPoint, sleep } from '../../tools/utils'; |
13 | 27 | import { delay, filterForCommands } from '../shared'; |
14 | | -import { ChangeStream, ChangeStreamDocument, ChangeStreamOptions, ResumeToken } from '../../../src/change_stream'; |
15 | | -import { MongoClient } from '../../../src/mongo_client'; |
16 | | -import { ReadPreference } from '../../../src/read_preference'; |
17 | | -import { Collection } from '../../../src/collection'; |
18 | | -import { Db } from '../../../src/db'; |
19 | | -import { CommandStartedEvent } from '../../../src/cmap/command_monitoring_events'; |
20 | | -import { isHello } from '../../../src/utils'; |
21 | | -import { LEGACY_HELLO_COMMAND } from '../../../src/constants'; |
22 | | -import { MongoAPIError, MongoChangeStreamError, MongoServerError } from '../../../src/error'; |
23 | 28 |
|
24 | 29 | const initIteratorMode = async (cs: ChangeStream) => { |
25 | 30 | const initEvent = once(cs.cursor, 'init'); |
@@ -469,8 +474,8 @@ describe('Change Streams', function () { |
469 | 474 | expect(res).to.exist; |
470 | 475 |
|
471 | 476 | const err = await changeStream.next().catch(e => e); |
472 | | - expect(err).to.exist; |
473 | | - console.log(`pavel >>> ${JSON.stringify(err)}`); |
| 477 | + expect(err).to.exist; |
| 478 | + console.log(`pavel >>> ${JSON.stringify(err)}`); |
474 | 479 | await changeStream.close(); |
475 | 480 | await client.close(); |
476 | 481 | } |
@@ -1306,7 +1311,7 @@ describe('Change Streams', function () { |
1306 | 1311 | const collection = client.db('cs').collection('test'); |
1307 | 1312 | const changeStream = collection.watch(); |
1308 | 1313 | try { |
1309 | | - await changeStream.next(); |
| 1314 | + await changeStream.next(); |
1310 | 1315 | } catch (err) { |
1311 | 1316 | expect(err).to.exist; |
1312 | 1317 | expect(err?.message).to.equal('ChangeStream is closed'); |
|
0 commit comments