"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const core_1 = require("@vived/core");
const Mocks_1 = require("../Mocks");
const PixelToSceneRayUC_1 = require("./PixelToSceneRayUC");
function makeTestRig() {
    const appObjects = (0, core_1.makeAppObjectRepo)();
    const ao = appObjects.getOrCreate("AO");
    const mockPickUC = (0, Mocks_1.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_1.PixelToSceneRayUC.get(appObjects)).toEqual(mockPickUC);
    });
    it("Finds and uses the SceneRayPickUC", () => {
        const { appObjects, mockPickUC } = makeTestRig();
        (0, PixelToSceneRayUC_1.pixelToSceneRay)(new core_1.Vector2(1, 2), appObjects);
        expect(mockPickUC.pixelToSceneRay).toHaveBeenCalledWith(new core_1.Vector2(1, 2));
    });
    it("Warns if it can't find SceneRayPickUC", () => {
        const { mockPickUC, appObjects, mockSubmitWarning } = makeTestRig();
        mockPickUC.dispose();
        (0, PixelToSceneRayUC_1.pixelToSceneRay)(new core_1.Vector2(1, 2), appObjects);
        expect(mockSubmitWarning).toHaveBeenCalled();
    });
});
//# sourceMappingURL=PixelToSceneRayUC.test.js.map