Skip to content

Commit

Permalink
default Request object, fix unit test (#118)
Browse files Browse the repository at this point in the history
Co-authored-by: Ihor Bodnarchuk <[email protected]>
  • Loading branch information
ihorbond and Ihor Bodnarchuk authored Oct 18, 2023
1 parent 4607f4c commit 860eac6
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"no-multi-str": 0
},
"parserOptions": {
"ecmaVersion": 6,
"ecmaVersion": "latest",
"sourceType": "module"
}
}
6 changes: 5 additions & 1 deletion src/superagent-mock.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@
* @param logger Logger callback
*/
module.exports = function (superagent, config, logger) {
const Request = superagent.Request;
const Request = superagent.Request ?? {
prototype: {
end: function() {}
}
};
let currentLog = {};
const logEnabled = !!logger;

Expand Down
2 changes: 1 addition & 1 deletion tests/client.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* @jest-environment jsdom
*/

global.window = {};
global.window ??= {};

// Get the "client" version of superagent
const request = require('superagent/lib/client');
Expand Down

0 comments on commit 860eac6

Please sign in to comment.