import { makeAppObjectRepo } from "@vived/core";
import { makeEnvironmentEntity } from "../Entities/Environment";
import { EnvironmentalIntensityPM, makeEnvironmentalIntensityPM, } from "./EnvironmentalIntensityPM";
function makeTestRig() {
    const appObjects = makeAppObjectRepo();
    const registerSpy = jest.spyOn(appObjects, "registerSingleton");
    const environment = makeEnvironmentEntity(appObjects.getOrCreate("Environment"));
    const pm = makeEnvironmentalIntensityPM(appObjects.getOrCreate("PM"));
    return {
        pm,
        environment,
        registerSpy,
        appObjects,
    };
}
describe("Environment Presentation Manager", () => {
    it("Gets the singleton", () => {
        const { appObjects, pm } = makeTestRig();
        expect(EnvironmentalIntensityPM.get(appObjects)).toEqual(pm);
    });
    it("Registers as the singleton", () => {
        const { registerSpy, pm } = makeTestRig();
        expect(registerSpy).toHaveBeenCalledWith(pm);
    });
    it("Sets the last vm on construction", () => {
        const { pm } = makeTestRig();
        expect(pm.lastVM).not.toBeUndefined();
    });
    it("Updates when entity updates", () => {
        const { environment, pm } = makeTestRig();
        environment.intensity = 0.666;
        expect(pm.lastVM).toEqual(0.666);
    });
});
//# sourceMappingURL=EnvironmentalIntensityPM.test.js.map