Skip to content

Commit 5debe99

Browse files
committed
the simplest aggregation test
1 parent 6d9a9d7 commit 5debe99

File tree

1 file changed

+16
-7
lines changed

1 file changed

+16
-7
lines changed

packages/mongodb-ts-autocomplete/src/index.spec.ts

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,7 @@ describe('MongoDBAutocompleter', function () {
2828
schemaInformationForAggregation: async () => {
2929
const docs = [
3030
{
31-
foo: 'foo',
32-
bar: 1,
33-
baz: {
34-
a: 1,
35-
b: 'b',
36-
},
31+
aggField: 'foo',
3732
},
3833
];
3934

@@ -93,7 +88,7 @@ describe('MongoDBAutocompleter', function () {
9388
]);
9489
});
9590

96-
it('completes a collection field name', async function () {
91+
it('completes a collection field name in a query', async function () {
9792
const completions = await autocompleter.autocomplete('db.foo.find({ fo', {
9893
connectionId: 'myConnection',
9994
databaseName: 'myDatabase',
@@ -117,4 +112,18 @@ describe('MongoDBAutocompleter', function () {
117112
},
118113
]);
119114
});
115+
116+
it('completes a collection field name in an aggregation', async function () {
117+
const completions = await autocompleter.autocomplete(
118+
'db.foo.aggregate([{ $match: { aggf',
119+
{
120+
connectionId: 'myConnection',
121+
databaseName: 'myDatabase',
122+
}
123+
);
124+
125+
expect(completions).to.deep.equal([
126+
{ name: 'aggField', kind: 'property', type: 'string' },
127+
]);
128+
});
120129
});

0 commit comments

Comments
 (0)