"use strict";
// SPDX-License-Identifier: Apache-2.0
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const ts_jest_1 = require("@golevelup/ts-jest");
const DataFixture_1 = require("../../../../../../../../__tests__/fixtures/shared/DataFixture");
const EvmAddress_1 = __importDefault(require("../../../../../../../domain/context/contract/EvmAddress"));
const IsPausedMockQueryHandler_1 = require("./IsPausedMockQueryHandler");
const IsPausedMockQuery_1 = require("./IsPausedMockQuery");
const ExternalPausesFixture_1 = require("../../../../../../../../__tests__/fixtures/externalPauses/ExternalPausesFixture");
describe("IsPausedMockQueryHandler", () => {
    let handler;
    let query;
    const rpcQueryAdapterMock = (0, ts_jest_1.createMock)();
    const contractServiceMock = (0, ts_jest_1.createMock)();
    const contractEvmAddress = new EvmAddress_1.default(DataFixture_1.EvmAddressPropsFixture.create().value);
    beforeEach(() => {
        handler = new IsPausedMockQueryHandler_1.IsPausedMockQueryHandler(contractServiceMock, rpcQueryAdapterMock);
        query = ExternalPausesFixture_1.IsPausedMockQueryFixture.create();
    });
    afterEach(() => {
        jest.resetAllMocks();
    });
    describe("execute", () => {
        it("should successfully verify if is pause", async () => {
            contractServiceMock.getContractEvmAddress.mockResolvedValueOnce(contractEvmAddress);
            rpcQueryAdapterMock.isPausedMock.mockResolvedValue(true);
            const result = await handler.execute(query);
            expect(result).toBeInstanceOf(IsPausedMockQuery_1.IsPausedMockQueryResponse);
            expect(result.payload).toBe(true);
            expect(contractServiceMock.getContractEvmAddress).toHaveBeenCalledTimes(1);
            expect(rpcQueryAdapterMock.isPausedMock).toHaveBeenCalledTimes(1);
            expect(contractServiceMock.getContractEvmAddress).toHaveBeenCalledWith(query.contractId);
            expect(rpcQueryAdapterMock.isPausedMock).toHaveBeenCalledWith(contractEvmAddress);
        });
    });
});
