mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-06 22:40:14 -05:00
178e7db066
refs https://github.com/TryGhost/Toolbox/issues/214 - The constructor logic was duplicated across test agents, so made sence to extract the logic into a common class
22 lines
539 B
JavaScript
22 lines
539 B
JavaScript
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
|
|
}
|
|
});
|
|
}
|
|
}
|
|
|
|
module.exports = TestAgent;
|