"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const core_1 = require("@vived/core");
const core_2 = require("@vived/core");
const StoredView_1 = require("./StoredView");
function makeTestRig() {
    const appObjects = (0, core_1.makeAppObjectRepo)();
    const rootAO = appObjects.getOrCreate(StoredView_1.StoredView.type);
    const storedView = (0, StoredView_1.makeStoredView)(rootAO);
    const observer = jest.fn();
    storedView.addChangeObserver(observer);
    return { storedView, observer, appObjects };
}
describe("Scene Root Entity", () => {
    it("Sets the position", () => {
        const { storedView, observer } = makeTestRig();
        expect(storedView.position).toEqual(core_2.Vector3.Zero());
        observer.mockClear();
        storedView.position = new core_2.Vector3(1, 2, 3);
        expect(observer).toHaveBeenCalled();
        expect(storedView.position).toEqual(new core_2.Vector3(1, 2, 3));
        observer.mockClear();
        storedView.position = new core_2.Vector3(1, 2, 3);
        expect(observer).not.toHaveBeenCalled();
    });
    it("Sets the rotation", () => {
        const { storedView, observer } = makeTestRig();
        expect(storedView.rotation).toEqual(core_2.Quaternion.Identity());
        observer.mockClear();
        storedView.rotation = new core_2.Quaternion(1, 1, 1, 1);
        expect(observer).toHaveBeenCalled();
        expect(storedView.rotation).toEqual(new core_2.Quaternion(1, 1, 1, 1));
        observer.mockClear();
        storedView.rotation = new core_2.Quaternion(1, 1, 1, 1);
        expect(observer).not.toHaveBeenCalled();
    });
    it("Sets the scale", () => {
        const { storedView, observer } = makeTestRig();
        expect(storedView.scale).toEqual(1);
        observer.mockClear();
        storedView.scale = 2;
        expect(observer).toHaveBeenCalled();
        expect(storedView.scale).toEqual(2);
        observer.mockClear();
        storedView.scale = 2;
        expect(observer).not.toHaveBeenCalled();
    });
    it("Sets has stored view", () => {
        const { storedView, observer } = makeTestRig();
        expect(storedView.hasStoredView).toEqual(false);
        observer.mockClear();
        storedView.hasStoredView = true;
        expect(observer).toHaveBeenCalled();
        expect(storedView.hasStoredView).toEqual(true);
        observer.mockClear();
        storedView.hasStoredView = true;
        expect(observer).not.toHaveBeenCalled();
    });
});
//# sourceMappingURL=StoredView.test.js.map