"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const core_1 = require("@vived/core");
const Environment_1 = require("../Entities/Environment");
const TexturalEnvironmentPM_1 = require("./TexturalEnvironmentPM");
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, TexturalEnvironmentPM_1.makeTexturalEnvironmentPM)(appObjects.getOrCreate("PM"));
    return {
        pm,
        environment,
        registerSpy,
        appObjects,
    };
}
describe("Environment Presentation Manager", () => {
    it("Gets the singleton", () => {
        const { appObjects, pm } = makeTestRig();
        expect(TexturalEnvironmentPM_1.TexturalEnvironmentPM.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.currentEnvironment = Environment_1.Environments.FOREST;
        expect(pm.lastVM).toEqual(Environment_1.Environments.FOREST);
    });
});
//# sourceMappingURL=TexturalEnvironmentPM.test.js.map