Skip to content

Commit 6e5e048

Browse files
committed
fix tests
1 parent 37fd3a0 commit 6e5e048

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

test/aggregate.test.js

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -287,11 +287,14 @@ describe('aggregate: ', function() {
287287
it('works', function() {
288288
const aggregate = new Aggregate();
289289

290-
assert.equal(aggregate.near({ a: 1 }), aggregate);
291-
assert.deepEqual(aggregate._pipeline, [{ $geoNear: { a: 1 } }]);
290+
assert.equal(aggregate.near({ near: { type: 'Point', coordinates: [1, 2] } }), aggregate);
291+
assert.deepEqual(aggregate._pipeline, [{ $geoNear: { near: { type: 'Point', coordinates: [1, 2] } } }]);
292292

293-
aggregate.near({ b: 2 });
294-
assert.deepEqual(aggregate._pipeline, [{ $geoNear: { a: 1 } }, { $geoNear: { b: 2 } }]);
293+
aggregate.near({ near: { type: 'Point', coordinates: [3, 4] } });
294+
assert.deepEqual(aggregate._pipeline, [
295+
{ $geoNear: { near: { type: 'Point', coordinates: [1, 2] } } },
296+
{ $geoNear: { near: { type: 'Point', coordinates: [3, 4] } } }
297+
]);
295298
});
296299

297300
it('works with discriminators (gh-3304)', function() {
@@ -308,19 +311,19 @@ describe('aggregate: ', function() {
308311

309312
aggregate._model = stub;
310313

311-
assert.equal(aggregate.near({ a: 1 }), aggregate);
314+
assert.equal(aggregate.near({ near: { type: 'Point', coordinates: [1, 2] } }), aggregate);
312315
// Run exec so we apply discriminator pipeline
313316
Aggregate._prepareDiscriminatorPipeline(aggregate._pipeline, stub.schema);
314317
assert.deepEqual(aggregate._pipeline,
315-
[{ $geoNear: { a: 1, query: { __t: 'subschema' } } }]);
318+
[{ $geoNear: { near: { type: 'Point', coordinates: [1, 2] }, query: { __t: 'subschema' } } }]);
316319

317320
aggregate = new Aggregate();
318321
aggregate._model = stub;
319322

320-
aggregate.near({ b: 2, query: { x: 1 } });
323+
aggregate.near({ near: { type: 'Point', coordinates: [3, 4] }, query: { x: 1 } });
321324
Aggregate._prepareDiscriminatorPipeline(aggregate._pipeline, stub.schema);
322325
assert.deepEqual(aggregate._pipeline,
323-
[{ $geoNear: { b: 2, query: { x: 1, __t: 'subschema' } } }]);
326+
[{ $geoNear: { near: { type: 'Point', coordinates: [3, 4] }, query: { x: 1, __t: 'subschema' } } }]);
324327
});
325328
});
326329

0 commit comments

Comments
 (0)