Jordan (UNCVRD)
Jordan (UNCVRD)8mo ago

Unable to mock unstable_batchStreamLink network response

Hi there! I have a couple API endpoints that call third party dependencies and would like to mock a network response for these calls during my playwright tests. I've been using batchHttpLink previously and mocking the following API route worked perfectly:
const deleteOrganization = page.route(endpointPath("authed.organization.delete"), (route) =>
route.fulfill({
status: 200,
body: JSON.stringify([
{ result: { data: { json: { success: true } }, meta: { values: {} } } },
]),
headers: { 'Content-Type': 'application/json' },
})
)
const deleteOrganization = page.route(endpointPath("authed.organization.delete"), (route) =>
route.fulfill({
status: 200,
body: JSON.stringify([
{ result: { data: { json: { success: true } }, meta: { values: {} } } },
]),
headers: { 'Content-Type': 'application/json' },
})
)
However when I use unstable_batchStreamLink this returns an error stating Unexpected non-whitespace character after JSON at position 55 which kinda makes sense because it should be streaming a response back instead of immediately receiving a JSON object. But I'm kind of stumped on how I can update my mock response call to satisfy TRPC to return that streamed data instead? Anyone have insight on how to handle this? Thanks a lot for your time!
No description
No description
No description
No description
0 Replies
No replies yetBe the first to reply to this messageJoin