"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const core_1 = require("@vived/core");
const Environment_1 = require("../Entities/Environment");
const EnvironmentalIntensityPM_1 = require("./EnvironmentalIntensityPM");
function makeTestRig() {
    const appObjects = (0, core_1.makeAppObjectRepo)();
    const registerSpy = jest.spyOn(appObjects, "registerSingleton");
    const environment = (0, Environment_1.makeEnvironmentEntity)(appObjects.getOrCreate("Environment"));
    const pm = (0, EnvironmentalIntensityPM_1.makeEnvironmentalIntensityPM)(appObjects.getOrCreate("PM"));
    return {
        pm,
        environment,
        registerSpy,
        appObjects,
    };
}
describe("Environment Presentation Manager", () => {
    it("Gets the singleton", () => {
        const { appObjects, pm } = makeTestRig();
        expect(EnvironmentalIntensityPM_1.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