"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.toHaveSuspenseCacheEntryUsing = void 0;
const client_1 = require("@apollo/client");
const cache_1 = require("@apollo/client/cache");
const internal_1 = require("@apollo/client/react/internal");
const toHaveSuspenseCacheEntryUsing = function (client, query, { variables, queryKey = [] } = {}) {
    if (!(client instanceof client_1.ApolloClient)) {
        throw new Error("Actual must be an instance of `ApolloClient`");
    }
    const suspenseCache = (0, internal_1.getSuspenseCache)(client);
    const cacheKey = [
        query,
        (0, cache_1.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`;
        },
    };
};
exports.toHaveSuspenseCacheEntryUsing = toHaveSuspenseCacheEntryUsing;
//# sourceMappingURL=toHaveSuspenseCacheEntryUsing.cjs.map
