import { makeAppObjectRepo } from "@vived/core";
import { makeStylusEntity } from "../../Stylus";
import { makeHoverLabelEntity } from "../Entities/HoverLabelEntity";
import { makeMockTryShowHoverLabelUC } from "../Mocks/MockTryShowHoverLabelUC";
import { makeStylusHoverLabelController } from "./StylusHoverLabel";
function makeTestRig() {
    const appObjects = makeAppObjectRepo();
    const zSpaceAO = appObjects.getOrCreate("Stylus");
    const stylus = makeStylusEntity(zSpaceAO);
    const mockRegisterController = jest.fn();
    stylus.registerController = mockRegisterController;
    const appObject = appObjects.getOrCreate("AppObject");
    const hoverLabel = makeHoverLabelEntity(appObject);
    const mockTryShowHoverLabelUC = makeMockTryShowHoverLabelUC(appObjects);
    const controller = makeStylusHoverLabelController(appObject);
    return {
        hoverLabel,
        controller,
        mockTryShowHoverLabelUC,
        mockRegisterController,
    };
}
describe("Hover Label Mouse Controller", () => {
    it("Registers with the stylus input", () => {
        const { mockRegisterController, controller } = makeTestRig();
        expect(mockRegisterController).toHaveBeenCalledWith(controller);
    });
    it("Calls the UC when the stylus moves", () => {
        const { mockTryShowHoverLabelUC, controller } = makeTestRig();
        controller.onStylusMove();
        expect(mockTryShowHoverLabelUC.tryShowWorldHoverLabel).toHaveBeenCalled();
    });
    it("Does not call the UC when the stylus moves and allow returns false", () => {
        const { mockTryShowHoverLabelUC, controller } = makeTestRig();
        controller.allow = () => {
            return false;
        };
        controller.onStylusMove();
        expect(mockTryShowHoverLabelUC.tryShowWorldHoverLabel).not.toHaveBeenCalled();
    });
});
//# sourceMappingURL=StylusHoverLabel.test.js.map