import { makeAppObjectRepo } from "@vived/core";
import { makeEnablementEntity } from "./EnablementEntity";
function makeTestRig() {
    const appObjects = makeAppObjectRepo();
    const appObject = appObjects.getOrCreate("appObj1");
    const enablement = makeEnablementEntity(appObject);
    const observer = jest.fn();
    enablement.addChangeObserver(observer);
    return { enablement, observer, appObject, appObjects };
}
describe("Enablement Entity", () => {
    it("Notifies when the enabled state changes", () => {
        const { observer, enablement } = makeTestRig();
        enablement.enabled = false;
        observer.mockClear();
        enablement.enabled = true;
        expect(observer).toHaveBeenCalled();
    });
    it("Does not notify when enabled state does not change", () => {
        const { observer, enablement } = makeTestRig();
        enablement.enabled = true;
        observer.mockClear();
        enablement.enabled = true;
        enablement.enabled = true;
        enablement.enabled = true;
        expect(observer).not.toHaveBeenCalled();
    });
});
//# sourceMappingURL=EnablementEntity.test.js.map