import { makeAppObjectRepo } from "@vived/core";
import { MockAppHandlerEntity } from "../Mocks/MockAppHandlerEntity";
import { makeDisposeAppUC } from "./DisposeAppUC";
function makeTestRig() {
    const appObjectRepo = makeAppObjectRepo();
    const handlerAO = appObjectRepo.getOrCreate("Handler");
    const mockAppHandler = new MockAppHandlerEntity(handlerAO);
    const disposeApp = 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