I have this query but it's not getting called by MSW.
const response = (await API.graphql(graphqlOperation(listNotarys, { filter: filterInput }))) as {
data: unknown;
};
My handler looks like the following:
graphql.query("ListNotarys", (req, res, ctx) =>
res(
ctx.data({
data: {
listNotarys: {
items: [
{
id: "123",
email: "email@gmail.com",
name: "Name Here",
phone: null,
group: "GROUP_A",
lastSigningDate: null,
createdAt: "2021-11-12T14:06:57.492Z",
updatedAt: "2021-11-12T14:32:07.190Z",
},
],
nextToken: null,
},
},
}),
),
),
I have a setupTests.ts file that looks like this:
beforeAll(() => {
awsAmplify.Auth.signIn.mockRejectedValue("mock error");
awsAmplify.Auth.currentAuthenticatedUser.mockResolvedValue("mock user");
server.listen({ onUnhandledRequest: "error" });
});
afterEach(() => server.resetHandlers());
afterAll(() => server.close());
I get the following error when in my console:
An unhandled error occured processing a request for the endpoint "listNotarys".
In the case of an unhandled error, no tags will be "provided" or "invalidated". [TypeError: Cannot read property 'error' of undefined]