testing a trpc hook
i'm brand new to testing and need some help with writing a test for a hook that is returning an object. im stuck with the error messages. i'm using trpc and react query
my test
my test
export function useGetTenantTickets() {
const setTickets = useTenantStore((state) => state.setTickets);
const { isLoading, isError } = trpc.ticketDomain.getByTenantId.useQuery(
undefined,
{
onSuccess: (data) => {
setTickets(data);
},
}
);
return { isLoading, isError };
} it('should return an object', async () => {
const tickets = renderer.create(<TenantTicketsScreen />);
const result = useGetTenantTickets();
const expected = {
isError: expect.any(Boolean),
isLoading: expect.any(Boolean),
};
expect(result).toEqual(expected);
});