"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.MockDispatchStateChange = void 0;
const core_1 = require("@vived/core");
const Dispatcher_1 = require("../../Dispatcher");
const HoverLabelEntity_1 = require("../Entities/HoverLabelEntity");
const ToggleAllowHoverLabel_1 = require("./ToggleAllowHoverLabel");
class MockDispatchStateChange extends Dispatcher_1.DispatchStateChangeUC {
    constructor(appObject) {
        super(appObject, Dispatcher_1.DispatchStateChangeUC.type);
        this.validateState = jest.fn();
        this.getStateAssets = jest.fn();
        this.doDispatch = jest.fn();
    }
}
exports.MockDispatchStateChange = MockDispatchStateChange;
function makeTestRig() {
    const appObjects = (0, core_1.makeAppObjectRepo)();
    const appObj = appObjects.getOrCreate("appObj");
    const hoverLabel = (0, HoverLabelEntity_1.makeHoverLabelEntity)(appObj);
    const toggleAllowHoverLabelUC = (0, ToggleAllowHoverLabel_1.makeToggleAllowHoverLabel)(appObj);
    const mockDispatchStateChange = new MockDispatchStateChange(appObj);
    return { hoverLabel, toggleAllowHoverLabelUC, mockDispatchStateChange };
}
describe("Toggle Allow Hover Label UC", () => {
    it("Toggles allowHoverLabel flag", () => {
        const { hoverLabel, toggleAllowHoverLabelUC } = makeTestRig();
        expect(hoverLabel.allowHoverLabel).toBeTruthy();
        toggleAllowHoverLabelUC.toggleAllowHoverLabel();
        expect(hoverLabel.allowHoverLabel).toBeFalsy();
    });
    it("Dispatches state change", () => {
        const { toggleAllowHoverLabelUC, mockDispatchStateChange } = makeTestRig();
        toggleAllowHoverLabelUC.toggleAllowHoverLabel();
        expect(mockDispatchStateChange.doDispatch).toHaveBeenCalled();
    });
});
//# sourceMappingURL=ToggleAllowHoverLabel.test.js.map