add test to explicitely check filter

This commit is contained in:
Tim Alby 2018-06-06 15:45:12 +02:00
parent e4da748257
commit 7726314e7c

View file

@ -69,6 +69,14 @@ describe "UserGetter", ->
user.should.deep.equal @fakeUser user.should.deep.equal @fakeUser
done() 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)-> it "checks main email as well", (done)->
@findOne.callsArgWith(2, null, null) @findOne.callsArgWith(2, null, null)
email = 'hello@world.com' email = 'hello@world.com'