"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const core_1 = require("@vived/core");
const Mocks_1 = require("../Mocks");
const SceneRayPickUC_1 = require("./SceneRayPickUC");
function makeTestRig() {
    const appObjects = (0, core_1.makeAppObjectRepo)();
    const ao = appObjects.getOrCreate("AO");
    const mockPickUC = (0, Mocks_1.makeMockSceneRayPickUC)(appObjects);
    const mockSubmitWarning = jest.fn();
    appObjects.submitWarning = mockSubmitWarning;
    return { appObjects, ao, mockPickUC, mockSubmitWarning };
}
describe("Dispatch State Change", () => {
    it("Gets the UC", () => {
        const { mockPickUC, appObjects } = makeTestRig();
        expect(SceneRayPickUC_1.SceneRayPickUC.get(appObjects)).toEqual(mockPickUC);
    });
    it("Finds and uses the SceneRayPickUC", () => {
        const { appObjects, mockPickUC } = makeTestRig();
        mockPickUC.sceneRayPick = jest.fn();
        const ray = core_1.ParametricLine.Forward();
        (0, SceneRayPickUC_1.sceneRayPick)(ray, appObjects);
        expect(mockPickUC.sceneRayPick).toHaveBeenCalledWith(ray);
    });
    it("Warns if it can't find SceneRayPickUC", () => {
        const { mockPickUC, appObjects, mockSubmitWarning } = makeTestRig();
        mockPickUC.dispose();
        const ray = core_1.ParametricLine.Forward();
        (0, SceneRayPickUC_1.sceneRayPick)(ray, appObjects);
        expect(mockSubmitWarning).toHaveBeenCalled();
    });
});
//# sourceMappingURL=SceneRayPickUC.test.js.map