From 7726314e7c8eed9d6e3620f81ca66448b7ec4184 Mon Sep 17 00:00:00 2001 From: Tim Alby Date: Wed, 6 Jun 2018 15:45:12 +0200 Subject: [PATCH] add test to explicitely check filter --- services/web/test/unit/coffee/User/UserGetterTests.coffee | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/services/web/test/unit/coffee/User/UserGetterTests.coffee b/services/web/test/unit/coffee/User/UserGetterTests.coffee index b25bab87a7..7fb14a7f7d 100644 --- a/services/web/test/unit/coffee/User/UserGetterTests.coffee +++ b/services/web/test/unit/coffee/User/UserGetterTests.coffee @@ -69,6 +69,14 @@ describe "UserGetter", -> user.should.deep.equal @fakeUser done() + it "query contains $exists:true so partial index is used", (done)-> + expectedQuery = + emails: { $exists: true } + 'emails.email': '' + @UserGetter.getUserByAnyEmail '', {}, (error, user) => + @findOne.calledWith(expectedQuery, {}).should.equal true + done() + it "checks main email as well", (done)-> @findOne.callsArgWith(2, null, null) email = 'hello@world.com'