import { ApolloClient } from "@apollo/client";
import { canonicalStringify } from "@apollo/client/cache";
import { getSuspenseCache } from "@apollo/client/react/internal";
export const toHaveSuspenseCacheEntryUsing = function (client, query, { variables, queryKey = [] } = {}) {
    if (!(client instanceof ApolloClient)) {
        throw new Error("Actual must be an instance of `ApolloClient`");
    }
    const suspenseCache = getSuspenseCache(client);
    const cacheKey = [
        query,
        canonicalStringify(variables),
        ...[].concat(queryKey),
    ];
    const queryRef = suspenseCache["queryRefs"].lookupArray(cacheKey)?.current;
    return {
        pass: !!queryRef,
        message: () => {
            return `Expected suspense cache ${queryRef ? "not " : ""}to have cache entry using key`;
        },
    };
};
//# sourceMappingURL=toHaveSuspenseCacheEntryUsing.js.map
