All files / src/DotProvider/utils/assetPromiseHandlers themeColorAssetPromise.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 { themeColorImports, themeColorMapping } from "../themeColorAssetsConfig";
import { validateAndLogError } from "../errorValidation";
import { LIBRARIES, THEME_COLORS } from "../constants";
 
export function getThemeColorAssetPromise({themeAppearance, themeColor}) {
    const isError = validateAndLogError({options: THEME_COLORS, value: themeColor, type: 'themeColor'});
    if(!isError) {
        const assetImportKeys = [];
        LIBRARIES.map(library => {
            const assetImportKey = themeColorMapping[library][themeColor][themeAppearance];
            assetImportKeys.push(assetImportKey);
        });
        return getAssetsImportPromises({
            assetImportKeys: assetImportKeys,
            assetImports: themeColorImports
        });
    }
    return [];
}