import { makeAppObjectRepo, Vector2 } from "@vived/core";
import { makeMockPixelToSceneRayUC } from "../Mocks";
import { pixelToSceneRay, PixelToSceneRayUC } from "./PixelToSceneRayUC";
function makeTestRig() {
    const appObjects = makeAppObjectRepo();
    const ao = appObjects.getOrCreate("AO");
    const mockPickUC = makeMockPixelToSceneRayUC(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(PixelToSceneRayUC.get(appObjects)).toEqual(mockPickUC);
    });
    it("Finds and uses the SceneRayPickUC", () => {
        const { appObjects, mockPickUC } = makeTestRig();
        pixelToSceneRay(new Vector2(1, 2), appObjects);
        expect(mockPickUC.pixelToSceneRay).toHaveBeenCalledWith(new Vector2(1, 2));
    });
    it("Warns if it can't find SceneRayPickUC", () => {
        const { mockPickUC, appObjects, mockSubmitWarning } = makeTestRig();
        mockPickUC.dispose();
        pixelToSceneRay(new Vector2(1, 2), appObjects);
        expect(mockSubmitWarning).toHaveBeenCalled();
    });
});
//# sourceMappingURL=PixelToSceneRayUC.test.js.map