Event Timeline
Comment Actions
Almost but no, i don't find the way to check for the proper req.user_requests_only == 1 which works:
let userRequests = [];
let otherUsersRequests = [];
cy.readFile('cypress/fixtures/add-forge-now-requests.json').then((result) => {
let requests = result['data'];
for (let i = 0; i < requests.length; i++) {
let request = requests[i];
console.log(request)
if (request.submitter_name === 'user') {
userRequests.push(request);
} else {
otherUsersRequests.push(request);
}
}
expect(userRequests.length).to.eq(2);
expect(otherUsersRequests.length).to.eq(4);
});
cy.intercept(`${this.listAddForgeRequestsUrl}**`, (req) => {
console.log(req);
console.log(req.body);
console.log(req.headers);
console.log(req.user_requests_only);
const data = req.user_requests_only == 1 ? userRequests : otherUsersRequests
req.reply({
statusCode: 201,
body: {
recordsTotal: 6,
draw: 1,
recordsFiltered: data.length,
data: data
}
});