Skip to content

Commit 3cb3d38

Browse files
committed
Merge branch 'main' into 1.29-releases
2 parents 75263e9 + a499788 commit 3cb3d38

File tree

2 files changed

+18
-16
lines changed

2 files changed

+18
-16
lines changed

packages/data-service/src/data-service.spec.ts

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1471,10 +1471,10 @@ describe('DataService', function () {
14711471
buz: ['foo', 'bar'],
14721472
},
14731473
});
1474-
const dbs = (await dataService.listCollections('buz')).map(
1475-
(db) => db.name
1474+
const colls = (await dataService.listCollections('buz')).map(
1475+
(coll) => coll.name
14761476
);
1477-
expect(dbs).to.deep.eq(['foo', 'bar']);
1477+
expect(colls).to.deep.eq(['foo', 'bar']);
14781478
});
14791479

14801480
it('returns collections with `find` privilege from privileges', async function () {
@@ -1496,10 +1496,10 @@ describe('DataService', function () {
14961496
},
14971497
},
14981498
});
1499-
const dbs = (await dataService.listCollections('foo')).map(
1500-
(db) => db.name
1499+
const colls = (await dataService.listCollections('foo')).map(
1500+
(coll) => coll.name
15011501
);
1502-
expect(dbs).to.deep.eq(['bar']);
1502+
expect(colls).to.deep.eq(['bar']);
15031503
});
15041504

15051505
it('filters out collections with no name from privileges', async function () {
@@ -1521,10 +1521,10 @@ describe('DataService', function () {
15211521
},
15221522
},
15231523
});
1524-
const dbs = (await dataService.listCollections('foo')).map(
1525-
(db) => db.name
1524+
const colls = (await dataService.listCollections('foo')).map(
1525+
(coll) => coll.name
15261526
);
1527-
expect(dbs).to.deep.eq(['buz']);
1527+
expect(colls).to.deep.eq(['buz']);
15281528
});
15291529

15301530
it('merges collections from listCollections and privileges', async function () {
@@ -1549,13 +1549,13 @@ describe('DataService', function () {
15491549
foo: ['buz', 'bla', 'meow'],
15501550
},
15511551
});
1552-
const dbs = (await dataService.listCollections('foo')).map(
1553-
(db) => db.name
1552+
const colls = (await dataService.listCollections('foo')).map(
1553+
(coll) => coll.name
15541554
);
1555-
expect(dbs).to.deep.eq(['bar', 'buz', 'bla', 'meow']);
1555+
expect(colls).to.deep.eq(['bar', 'buz', 'bla', 'meow']);
15561556
});
15571557

1558-
it('returns result from privileges even if listDatabases threw any error', async function () {
1558+
it('returns result from privileges even if listCollections threw any error', async function () {
15591559
const dataService = createDataServiceWithMockedClient({
15601560
commands: {
15611561
connectionStatus: {
@@ -1573,8 +1573,10 @@ describe('DataService', function () {
15731573
foo: new Error('nope'),
15741574
},
15751575
});
1576-
const dbs = (await dataService.listDatabases()).map((db) => db.name);
1577-
expect(dbs).to.deep.eq(['foo']);
1576+
const colls = (await dataService.listCollections('foo')).map(
1577+
(coll) => coll.name
1578+
);
1579+
expect(colls).to.deep.eq(['bar']);
15781580
});
15791581
});
15801582
});

packages/data-service/src/data-service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ class DataService extends EventEmitter {
348348

349349
const listCollections = async () => {
350350
try {
351-
return db.listCollections(filter, { nameOnly }).toArray();
351+
return await db.listCollections(filter, { nameOnly }).toArray();
352352
} catch (err) {
353353
// Currently Compass should not fail if listCollections failed for
354354
// any possible reason to preserve current behavior. We probably

0 commit comments

Comments
 (0)