Skip to content

Commit bd25b38

Browse files
await fix
1 parent e562fca commit bd25b38

File tree

1 file changed

+24
-34
lines changed

1 file changed

+24
-34
lines changed

test/integration/index-management/search-index-management.test.ts

Lines changed: 24 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
import { expect } from 'chai';
22

3-
import {
4-
type Collection,
5-
type CommandStartedEvent,
6-
type MongoClient,
7-
MongoError
8-
} from '../../mongodb';
3+
import { type Collection, type CommandStartedEvent, type MongoClient } from '../../mongodb';
94

105
describe('Search Index Management Integration Tests', function () {
116
describe('read concern and write concern ', function () {
@@ -28,35 +23,30 @@ describe('Search Index Management Integration Tests', function () {
2823
context('when listSearchIndexes operation is run withTransaction', function () {
2924
// TODO(NODE-6047): Ignore read/write concern in applySession for Atlas Search Index Helpers
3025
it('should include write concern or read concern in command - TODO(NODE-6047)', async function () {
31-
await client
32-
.withSession(session => {
33-
return session.withTransaction(
34-
async () => {
35-
expect(session.transaction.isStarting).to.equal(true);
36-
expect(session.transaction.isActive).to.equal(true);
37-
try {
38-
const res = collection.listSearchIndexes({ session });
39-
await res.toArray();
40-
} catch (e) {
41-
// uncomment following assertion after NODE-6047 is completed
42-
// expect(e.errmsg).to.match(/^.*Atlas.*$/);
43-
} finally {
44-
// uncomment following assertion after NODE-6047 is completed
45-
// expect(commandStartedEvents[0]).to.exist;
46-
if (commandStartedEvents[0]) {
47-
// flip following assertion after NODE-6047 is completed
48-
expect(commandStartedEvents[0]?.command?.readConcern).to.exist;
49-
expect(commandStartedEvents[0]?.command?.writeConcern).to.not.exist;
50-
}
26+
await client.withSession(async session => {
27+
return await session.withTransaction(
28+
async () => {
29+
expect(session.transaction.isStarting).to.equal(true);
30+
expect(session.transaction.isActive).to.equal(true);
31+
try {
32+
const res = collection.listSearchIndexes({ session });
33+
await res.toArray();
34+
} catch (e) {
35+
// uncomment following assertion after NODE-6047 is completed
36+
// expect(e.errmsg).to.match(/^.*Atlas.*$/);
37+
} finally {
38+
// uncomment following assertion after NODE-6047 is completed
39+
// expect(commandStartedEvents[0]).to.exist;
40+
if (commandStartedEvents[0]) {
41+
// flip following assertion after NODE-6047 is completed
42+
expect(commandStartedEvents[0]?.command?.readConcern).to.exist;
43+
expect(commandStartedEvents[0]?.command?.writeConcern).to.not.exist;
5144
}
52-
},
53-
{ readConcern: 'local', writeConcern: { w: 1 } }
54-
);
55-
})
56-
.catch(function (error) {
57-
expect(error).to.be.an.instanceof(MongoError);
58-
return error;
59-
});
45+
}
46+
},
47+
{ readConcern: 'local', writeConcern: { w: 1 } }
48+
);
49+
});
6050
});
6151
});
6252

0 commit comments

Comments
 (0)