import { makeAppObjectRepo } from "@vived/core";
import { MockRenderUC } from "../Mocks/MockRenderCanvasUC";
import { removeRenderCanvas } from "./removeRenderCanvas";
import { submitRenderCanvas } from "./submitRenderCanvas";
function makeTestRig() {
    const appObjects = makeAppObjectRepo();
    const appAO = appObjects.getOrCreate("App");
    const mockRenderUC = new MockRenderUC(appAO);
    const mockSubmitWarning = jest.fn();
    appObjects.submitWarning = mockSubmitWarning;
    return {
        mockRenderUC,
        mockSubmitWarning,
        appObjects,
    };
}
describe("Submit Render Canvas", () => {
    it("Submits the canvas to mockRenderUC", () => {
        const { mockRenderUC, appObjects } = makeTestRig();
        const renderCanvas = document.createElement("canvas");
        submitRenderCanvas(renderCanvas, appObjects);
        expect(mockRenderUC.submitCanvas).toHaveBeenCalledWith(renderCanvas);
    });
    it("Warns if it can't find the UC", () => {
        const { mockRenderUC, appObjects, mockSubmitWarning } = makeTestRig();
        mockRenderUC.dispose();
        removeRenderCanvas(appObjects);
        expect(mockSubmitWarning).toHaveBeenCalled();
    });
});
//# sourceMappingURL=submitRenderCanvas.test.js.map