"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const core_1 = require("@vived/core");
const MockAppHandlerEntity_1 = require("../Mocks/MockAppHandlerEntity");
const DisposeAppUC_1 = require("./DisposeAppUC");
function makeTestRig() {
    const appObjectRepo = (0, core_1.makeAppObjectRepo)();
    const handlerAO = appObjectRepo.getOrCreate("Handler");
    const mockAppHandler = new MockAppHandlerEntity_1.MockAppHandlerEntity(handlerAO);
    const disposeApp = (0, DisposeAppUC_1.makeDisposeAppUC)(handlerAO);
    return { mockAppHandler, disposeApp };
}
describe("Dispose App Base Handler", () => {
    it("Registers as a handler when constructed", () => {
        const { mockAppHandler, disposeApp } = makeTestRig();
        expect(mockAppHandler.registerRequestHandler).toHaveBeenCalledWith(disposeApp);
    });
    it("Triggers the action for v1", () => {
        const { disposeApp } = makeTestRig();
        disposeApp.action = jest.fn();
        disposeApp.handleRequest(1);
        expect(disposeApp.action).toHaveBeenCalled();
    });
    it("Throws for an unsupported version", () => {
        const { disposeApp } = makeTestRig();
        expect(() => disposeApp.handleRequest(-1)).toThrowError();
    });
});
//# sourceMappingURL=DisposeAppUC.test.js.map