-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Per title
if (lastArg === 'intercept') {
return cy
.intercept(`/api/trpc/${path}*`, (req) => {
// Extract and deserialize input from request
const input = req.body?.json && transformer.input.deserialize(req.body.json)?.json;
req.continue((res) => {
if (typedOpts[0]) {
const output =
res?.body?.result?.data &&
transformer.output.deserialize(res.body.result.data)?.json;
// Pass both input and output to the transform callback
const transformedOutput = typedOpts[0]({
input,
output,
});
res.body.result.data = {
json: transformer.output.serialize(transformedOutput),
};
}
});
})
.as(path);
}
it('should show threads list with the correct count', () => {
cy.api.thread.list.intercept(({ output, input }) => {
const pageSize = input?.limit || 20;
const totalThreadsCount = output.pageInfo.total_count;
cy.get('[data-testid=thread-list-container]')
.find(`[data-testid^="thread-item-"]`)
.should('have.length', Math.min(pageSize, totalThreadsCount));
return output;
});
});
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request