"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const core_1 = require("@vived/core");
const core_2 = require("@vived/core");
const Entities_1 = require("../Entities");
const getOnPrimaryColor_1 = require("./getOnPrimaryColor");
function makeTestRig() {
    const appObjects = (0, core_1.makeAppObjectRepo)();
    const theme = (0, Entities_1.makeThemeColors)(appObjects.getOrCreate("theme"));
    const mockColor = core_2.Color.Hex("123456");
    const getColorMock = jest.fn().mockReturnValue(mockColor);
    theme.getColorForType = getColorMock;
    return { getColorMock, appObjects, mockColor, theme };
}
describe("Get On Primary Color", () => {
    it("Queries the entity for the correct color type", () => {
        const { getColorMock, appObjects } = makeTestRig();
        (0, getOnPrimaryColor_1.getOnPrimaryColor)(appObjects);
        expect(getColorMock).toHaveBeenCalledWith(Entities_1.ThemeColorType.onPrimary);
    });
    it("Returns the color", () => {
        const { mockColor, appObjects } = makeTestRig();
        const c = (0, getOnPrimaryColor_1.getOnPrimaryColor)(appObjects);
        expect(c).toEqual(mockColor);
    });
    it("Warns if it cannot find the Theme Colors Entity", () => {
        const { theme, appObjects } = makeTestRig();
        appObjects.submitError = jest.fn();
        appObjects.submitWarning = jest.fn();
        theme.dispose();
        (0, getOnPrimaryColor_1.getOnPrimaryColor)(appObjects);
        expect(appObjects.submitError).toHaveBeenCalled();
    });
});
//# sourceMappingURL=getOnPrimaryColor.test.js.map