"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const core_1 = require("@vived/core");
const core_2 = require("@vived/core");
const StylusEntity_1 = require("../../Stylus/Entity/StylusEntity");
const TrySubmitObjectPickUCMock_1 = require("../Mocks/TrySubmitObjectPickUCMock");
const StylusObjectPickSC_1 = require("./StylusObjectPickSC");
function makeTestRig() {
    const appObjects = (0, core_1.makeAppObjectRepo)();
    const stylus = (0, StylusEntity_1.makeStylusEntity)(appObjects.getOrCreate("Input"));
    const registerSpy = jest.spyOn(stylus, "registerController");
    const trySubmit = (0, TrySubmitObjectPickUCMock_1.makeTrySubmitObjectPickUCMock)(appObjects).tryWithRay;
    const controller = new StylusObjectPickSC_1.StylusObjectPickSC(appObjects.getOrCreate("AO"));
    return { controller, registerSpy, trySubmit, stylus };
}
describe("Mouse Object Pick Controller", () => {
    it("Registers with the input when constructed", () => {
        const { registerSpy, controller } = makeTestRig();
        expect(registerSpy).toHaveBeenCalledWith(controller);
    });
    it("Doesn't trigger the UC when the click is not button 0", () => {
        const { controller, trySubmit } = makeTestRig();
        controller.onButtonClick(1);
        expect(trySubmit).not.toHaveBeenCalled();
    });
    it("Trigger the UC when the click is button 0", () => {
        const { controller, trySubmit } = makeTestRig();
        controller.onButtonClick(0);
        expect(trySubmit).toHaveBeenCalled();
    });
    it("Sends the", () => {
        const { controller, trySubmit, stylus } = makeTestRig();
        const ray = core_2.ParametricLine.FromTwoPoint(new core_2.Vector3(1, 2, 3), new core_2.Vector3(4, 5, 6));
        jest.spyOn(stylus, "pickRay", "get").mockReturnValue(ray);
        controller.onButtonClick(0);
        expect(trySubmit).toHaveBeenCalledWith(ray);
    });
});
//# sourceMappingURL=StylusObjectPickSC.test.js.map