mirror of
https://github.com/overleaf/overleaf.git
synced 2025-01-28 23:12:32 +00:00
This commit is contained in:
parent
47a7d2eaa9
commit
02854274a7
2 changed files with 13 additions and 1 deletions
|
@ -34,7 +34,7 @@ module.exports = UserGetter =
|
||||||
|
|
||||||
getUserAffiliations userId, (error, affiliationsData) ->
|
getUserAffiliations userId, (error, affiliationsData) ->
|
||||||
return callback error if error?
|
return callback error if error?
|
||||||
callback null, decorateFullEmails(user.email, user.emails, affiliationsData)
|
callback null, decorateFullEmails(user.email, user.emails or [], affiliationsData)
|
||||||
|
|
||||||
getUserByMainEmail: (email, projection, callback = (error, user) ->) ->
|
getUserByMainEmail: (email, projection, callback = (error, user) ->) ->
|
||||||
email = email.trim()
|
email = email.trim()
|
||||||
|
|
|
@ -93,6 +93,18 @@ describe "UserGetter", ->
|
||||||
]
|
]
|
||||||
done()
|
done()
|
||||||
|
|
||||||
|
it "should get user when it has no emails field", (done)->
|
||||||
|
@fakeUser =
|
||||||
|
_id: '12390i'
|
||||||
|
email: 'email2@foo.bar'
|
||||||
|
@UserGetter.getUser = sinon.stub().callsArgWith(2, null, @fakeUser)
|
||||||
|
projection = email: 1, emails: 1
|
||||||
|
@UserGetter.getUserFullEmails @fakeUser._id, (error, fullEmails) =>
|
||||||
|
@UserGetter.getUser.called.should.equal true
|
||||||
|
@UserGetter.getUser.calledWith(@fakeUser._id, projection).should.equal true
|
||||||
|
assert.deepEqual fullEmails, []
|
||||||
|
done()
|
||||||
|
|
||||||
describe "getUserbyMainEmail", ->
|
describe "getUserbyMainEmail", ->
|
||||||
it "query user by main email", (done)->
|
it "query user by main email", (done)->
|
||||||
email = 'hello@world.com'
|
email = 'hello@world.com'
|
||||||
|
|
Loading…
Reference in a new issue