"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const core_1 = require("@vived/core");
const MockRenderCanvasUC_1 = require("../Mocks/MockRenderCanvasUC");
const removeRenderCanvas_1 = require("./removeRenderCanvas");
const submitRenderCanvas_1 = require("./submitRenderCanvas");
function makeTestRig() {
    const appObjects = (0, core_1.makeAppObjectRepo)();
    const appAO = appObjects.getOrCreate("App");
    const mockRenderUC = new MockRenderCanvasUC_1.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");
        (0, submitRenderCanvas_1.submitRenderCanvas)(renderCanvas, appObjects);
        expect(mockRenderUC.submitCanvas).toHaveBeenCalledWith(renderCanvas);
    });
    it("Warns if it can't find the UC", () => {
        const { mockRenderUC, appObjects, mockSubmitWarning } = makeTestRig();
        mockRenderUC.dispose();
        (0, removeRenderCanvas_1.removeRenderCanvas)(appObjects);
        expect(mockSubmitWarning).toHaveBeenCalled();
    });
});
//# sourceMappingURL=submitRenderCanvas.test.js.map