2022-02-21 07:19:07 +03:00
|
|
|
const Agent = require('@tryghost/express-test');
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @constructor
|
|
|
|
* @param {Object} app Ghost express app instance
|
|
|
|
* @param {Object} options
|
|
|
|
* @param {String} options.apiURL
|
|
|
|
* @param {String} options.originURL
|
|
|
|
*/
|
|
|
|
class TestAgent extends Agent {
|
|
|
|
constructor(app, options) {
|
|
|
|
super(app, {
|
|
|
|
baseUrl: options.apiURL,
|
|
|
|
headers: {
|
|
|
|
host: options.originURL.replace(/http:\/\//, ''),
|
|
|
|
origin: options.originURL
|
2022-02-22 05:41:50 +03:00
|
|
|
},
|
|
|
|
queryParams: options.queryParams
|
2022-02-21 07:19:07 +03:00
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = TestAgent;
|