import { makeAppObjectRepo, ParametricLine } from "@vived/core";
import { makeMockSceneRayPickUC } from "../Mocks";
import { sceneRayPick, SceneRayPickUC } from "./SceneRayPickUC";
function makeTestRig() {
    const appObjects = makeAppObjectRepo();
    const ao = appObjects.getOrCreate("AO");
    const mockPickUC = 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.get(appObjects)).toEqual(mockPickUC);
    });
    it("Finds and uses the SceneRayPickUC", () => {
        const { appObjects, mockPickUC } = makeTestRig();
        mockPickUC.sceneRayPick = jest.fn();
        const ray = ParametricLine.Forward();
        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 = ParametricLine.Forward();
        sceneRayPick(ray, appObjects);
        expect(mockSubmitWarning).toHaveBeenCalled();
    });
});
//# sourceMappingURL=SceneRayPickUC.test.js.map