All files / src/DotProvider/utils/assetPromiseHandlers themeAppearanceAssetPromise.js

100% Statements 8/8
100% Branches 2/2
100% Functions 2/2
100% Lines 8/8

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20            50x 50x 49x 49x 147x 147x   49x         1x  
import { getAssetsImportPromises } from "../getAssetsImportPromises";
import { themeAppearanceImports, themeAppearanceMapping } from "../themeAppearanceAssetsConfig";
import { validateAndLogError } from "../errorValidation";
import { LIBRARIES, THEME_APPEARANCES } from "../constants";
 
export function getThemeAppearanceAssetPromise({themeAppearance}) {
    const isError = validateAndLogError({options: THEME_APPEARANCES, value: themeAppearance, type: 'themeAppearance'});
    if(!isError) {
        const assetImportKeys = [];
        LIBRARIES.map(library => {
            const assetImportKey = themeAppearanceMapping[library][themeAppearance];
            assetImportKeys.push(assetImportKey);
        });
        return getAssetsImportPromises({
            assetImportKeys: assetImportKeys,
            assetImports: themeAppearanceImports
        });
    }
    return [];
}