"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.withErrorSpy = withErrorSpy;
exports.withWarningSpy = withWarningSpy;
exports.withLogSpy = withLogSpy;
function wrapTestFunction(fn, consoleMethodName) {
    return function (...args) {
        const spy = jest.spyOn(console, consoleMethodName);
        spy.mockImplementation(() => { });
        return new Promise((resolve) => {
            resolve(fn?.apply(this, args));
        }).finally(() => {
            expect(spy).toMatchSnapshot();
            spy.mockReset();
        });
    };
}
/** @deprecated This method will be removed in the next major version of Apollo Client */
function withErrorSpy(it, ...args) {
    args[1] = wrapTestFunction(args[1], "error");
    return it(...args);
}
/** @deprecated This method will be removed in the next major version of Apollo Client */
function withWarningSpy(it, ...args) {
    args[1] = wrapTestFunction(args[1], "warn");
    return it(...args);
}
/** @deprecated This method will be removed in the next major version of Apollo Client */
function withLogSpy(it, ...args) {
    args[1] = wrapTestFunction(args[1], "log");
    return it(...args);
}
//# sourceMappingURL=withConsoleSpy.cjs.map
