"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const core_1 = require("@vived/core");
const Stylus_1 = require("../../Stylus");
const HoverLabelEntity_1 = require("../Entities/HoverLabelEntity");
const MockTryShowHoverLabelUC_1 = require("../Mocks/MockTryShowHoverLabelUC");
const StylusHoverLabel_1 = require("./StylusHoverLabel");
function makeTestRig() {
    const appObjects = (0, core_1.makeAppObjectRepo)();
    const zSpaceAO = appObjects.getOrCreate("Stylus");
    const stylus = (0, Stylus_1.makeStylusEntity)(zSpaceAO);
    const mockRegisterController = jest.fn();
    stylus.registerController = mockRegisterController;
    const appObject = appObjects.getOrCreate("AppObject");
    const hoverLabel = (0, HoverLabelEntity_1.makeHoverLabelEntity)(appObject);
    const mockTryShowHoverLabelUC = (0, MockTryShowHoverLabelUC_1.makeMockTryShowHoverLabelUC)(appObjects);
    const controller = (0, StylusHoverLabel_1.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