// SPDX-License-Identifier: Apache-2.0
import { createMock } from "@golevelup/ts-jest";
import { EvmAddressPropsFixture } from "../../../../../../../../__tests__/fixtures/shared/DataFixture";
import EvmAddress from "../../../../../../../domain/context/contract/EvmAddress";
import { IsPausedMockQueryHandler } from "./IsPausedMockQueryHandler";
import { IsPausedMockQueryResponse } from "./IsPausedMockQuery";
import { IsPausedMockQueryFixture } from "../../../../../../../../__tests__/fixtures/externalPauses/ExternalPausesFixture";
describe("IsPausedMockQueryHandler", () => {
    let handler;
    let query;
    const rpcQueryAdapterMock = createMock();
    const contractServiceMock = createMock();
    const contractEvmAddress = new EvmAddress(EvmAddressPropsFixture.create().value);
    beforeEach(() => {
        handler = new IsPausedMockQueryHandler(contractServiceMock, rpcQueryAdapterMock);
        query = 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(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);
        });
    });
});
