test_helpers-1.0.0-alpha6/tests/modules/test_helpers_http_client_mock/tests/src/Nightwatch/Commands/thGetLastRequestsHashes.js
tests/modules/test_helpers_http_client_mock/tests/src/Nightwatch/Commands/thGetLastRequestsHashes.js
/**
* @file
* Defines the ThGetLastRequestsHashes Nightwatch command.
*/
module.exports = class ThGetLastRequestsHashes {
/**
* Command to get the last requests hashes.
*
* @param {function} callback
* A callback function to be called with the result.
*
* @return {Promise<Array>}
* A promise that resolves to an array of request hashes.
*/
async command(callback) {
const endpoint = '/test-helpers-http-client-mock/get-last-requests-hashes';
const response = await this.api.thDrupalFetchURL(endpoint);
const hashes = JSON.parse(response.body);
if (typeof callback === 'function') {
const self = this;
callback.call(self, {
status: 0,
value: hashes,
});
}
return hashes;
}
};
