import {injectModules} from "../packages/modules/index.js";

describe("injectModules", () => {
    it("should exclude specific modules", () => {
        const config = injectModules({
            modules: {
                markup: false,
            },
        });
        expect(config.styles[".h1"]).toBeUndefined();
    });
    
    it("should include only specific modules", () => {
        const config = injectModules({
            modules: [
                "button",
                "alert",
            ],
        });
        expect(Object.keys(config.styles)).toHaveLength(2);
    });

    it("should exclude all modules if empty array is provided", () => {
        const config = injectModules({
            modules: [],
        });
        expect(Object.keys(config.styles)).toHaveLength(0);
    });

    it("should exclude all modules if 'false' value is provided", () => {
        const config = injectModules({
            modules: false,
        });
        expect(Object.keys(config.styles)).toHaveLength(0);
    });

    it("should exclude all modules if 'null' value is provided", () => {
        const config = injectModules({
            modules: null,
        });
        expect(Object.keys(config.styles)).toHaveLength(0);
    });
});

@@ -14,16 +14,30 @@
 tModules
+, createHelper
 %7D from %22
@@ -1261,12 +1261,1158 @@
     %7D);%0A%7D);%0A
+%0Adescribe(%22createHelper%22, () =%3E %7B%0A    it(%22should generate helpers from values%22, () =%3E %7B%0A        const styles = createHelper(%7B%0A            prefix: %22has%22,%0A            shortcut: %22text%22,%0A            properties: %5B%22color%22%5D,%0A            values: %7B%0A                blue: %22blue%22,%0A                white: %22white%22,%0A            %7D,%0A        %7D);%0A        const keys = Object.keys(styles);%0A%0A        expect(keys).toHaveLength(2);%0A        expect(keys%5B0%5D).toEqual(%22.has-text-blue%22);%0A        expect(keys%5B1%5D).toEqual(%22.has-text-white%22);%0A    %7D);%0A%0A    it(%22should generate helpers from scale%22, () =%3E %7B%0A        const config = %7B%0A            fontSizes: %5B%221%22, %222%22, %223%22%5D,%0A        %7D;%0A        const helper = %7B%0A            prefix: %22has%22,%0A            shortcut: %22size%22,%0A            properties: %5B%22fontSize%22%5D,%0A            scale: %22fontSizes%22,%0A        %7D;%0A        const styles = createHelper(helper, config);%0A        const keys = Object.keys(styles);%0A%0A        expect(keys).toHaveLength(3);%0A        keys.forEach((key, index) =%3E %7B%0A            expect(key).toEqual(%60.has-size-$%7Bindex%7D%60);%0A            expect(styles%5Bkey%5D.fontSize?.%5B0%5D).toEqual(config.fontSizes%5Bindex%5D);%0A        %7D);%0A    %7D);%0A%7D);%0A

update modules tests