Merge pull request #3750 from overleaf/jpa-req-ip-in-unit-tests

[misc] test/unit: add req.ip to MockRequest helper

GitOrigin-RevId: 07b1cf11f20eccb4c002a21f4a59588d201a3f0c
This commit is contained in:
Jakob Ackermann 2021-03-26 10:52:31 +01:00 committed by Copybot
parent 4280a96b2c
commit 0ca9d0236c
2 changed files with 2 additions and 1 deletions

View file

@ -68,7 +68,7 @@ describe('AuthenticationController', function() {
hooks: { fire: sinon.stub().yields(null, []) } hooks: { fire: sinon.stub().yields(null, []) }
}), }),
'../Notifications/NotificationsBuilder': (this.NotificationsBuilder = { '../Notifications/NotificationsBuilder': (this.NotificationsBuilder = {
ipMatcherAffiliation: sinon.stub() ipMatcherAffiliation: sinon.stub().returns({ create: sinon.stub() })
}), }),
'../../models/User': { User: this.UserModel }, '../../models/User': { User: this.UserModel },
'../../../../modules/oauth2-server/app/src/Oauth2Server': (this.Oauth2Server = { '../../../../modules/oauth2-server/app/src/Oauth2Server': (this.Oauth2Server = {

View file

@ -9,6 +9,7 @@ class MockRequest {
static initClass() { static initClass() {
this.prototype.session = { destroy() {} } this.prototype.session = { destroy() {} }
this.prototype.ip = '42.42.42.42'
this.prototype.headers = {} this.prototype.headers = {}
this.prototype.params = {} this.prototype.params = {}
this.prototype.query = {} this.prototype.query = {}