import { makeAppObjectRepo } from "@vived/core";
import { Environments, makeEnvironmentEntity } from "../Entities/Environment";
import { makeTexturalEnvironmentPM, TexturalEnvironmentPM, } from "./TexturalEnvironmentPM";
function makeTestRig() {
    const appObjects = makeAppObjectRepo();
    const registerSpy = jest.spyOn(appObjects, "registerSingleton");
    const environment = makeEnvironmentEntity(appObjects.getOrCreate("Environment"));
    const pm = makeTexturalEnvironmentPM(appObjects.getOrCreate("PM"));
    return {
        pm,
        environment,
        registerSpy,
        appObjects,
    };
}
describe("Environment Presentation Manager", () => {
    it("Gets the singleton", () => {
        const { appObjects, pm } = makeTestRig();
        expect(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 = Environments.FOREST;
        expect(pm.lastVM).toEqual(Environments.FOREST);
    });
});
//# sourceMappingURL=TexturalEnvironmentPM.test.js.map