import { makeAppObjectRepo } from "@vived/core";
import { DispatchStateChangeUC } from "../../Dispatcher";
import { makeHoverLabelEntity } from "../Entities/HoverLabelEntity";
import { makeToggleAllowHoverLabel } from "./ToggleAllowHoverLabel";
export class MockDispatchStateChange extends DispatchStateChangeUC {
    constructor(appObject) {
        super(appObject, DispatchStateChangeUC.type);
        this.validateState = jest.fn();
        this.getStateAssets = jest.fn();
        this.doDispatch = jest.fn();
    }
}
function makeTestRig() {
    const appObjects = makeAppObjectRepo();
    const appObj = appObjects.getOrCreate("appObj");
    const hoverLabel = makeHoverLabelEntity(appObj);
    const toggleAllowHoverLabelUC = 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