| 79 | }; |
| 80 | |
| 81 | const getMocks = () => { |
| 82 | const req = { |
| 83 | headers: {}, |
| 84 | query: {}, |
| 85 | body: {}, |
| 86 | get: function (header) { |
| 87 | return this.headers[header]; |
| 88 | }, |
| 89 | }; |
| 90 | sinon.spy(req, 'get'); |
| 91 | const res = { |
| 92 | headers: {}, |
| 93 | send: sinon.stub().returnsThis(), |
| 94 | json: sinon.stub().returnsThis(), |
| 95 | end: sinon.stub().returnsThis(), |
| 96 | status: function (statusCode) { |
| 97 | this.statusCode = statusCode; |
| 98 | return this; |
| 99 | }, |
| 100 | set: function (header, value) { |
| 101 | this.headers[header] = value; |
| 102 | return this; |
| 103 | }, |
| 104 | }; |
| 105 | sinon.spy(res, 'status'); |
| 106 | sinon.spy(res, 'set'); |
| 107 | return { |
| 108 | req: req, |
| 109 | res: res, |
| 110 | }; |
| 111 | }; |
| 112 | |
| 113 | const stubConsole = function () { |
| 114 | sinon.stub(console, 'error'); |