<commit_before>import { stringify } from 'rebem-classname';
import ReactTestUtils from 'react-addons-test-utils';

const reBEMTestUtils = Object.create(ReactTestUtils);

reBEMTestUtils.isCompositeComponentWithBEM = function(instance, bemjson) {
    if (instance.className) {
        const targetClasses = instance.className.split(' ');
        const matchClasses = stringify(bemjson).split(' ');

        return matchClasses.every(matchClass => {
            return targetClasses.indexOf(matchClass) !== -1;
        });
    }

    return false;
};

reBEMTestUtils.scryRenderedDOMComponentsWithBEM = function(tree, bemjson) {
    return reBEMTestUtils.findAllInRenderedTree(tree, instance => {
        return reBEMTestUtils.isCompositeComponentWithBEM(instance, bemjson);
    });
};<commit_msg>:heavy_check_mark: fix missing BEMJSON validation<commit_after>import { stringify, validate } from 'rebem-classname';
import ReactTestUtils from 'react-addons-test-utils';

const reBEMTestUtils = Object.create(ReactTestUtils);

reBEMTestUtils.isCompositeComponentWithBEM = function(instance, bemjson) {
    if (instance.className) {
        const targetClasses = instance.className.split(' ');
        const matchClasses = stringify(validate(bemjson)).split(' ');

        return matchClasses.every(matchClass => {
            return targetClasses.indexOf(matchClass) !== -1;
        });
    }

    return false;
};

reBEMTestUtils.scryRenderedDOMComponentsWithBEM = function(tree, bemjson) {
    return reBEMTestUtils.findAllInRenderedTree(tree, instance => {
        return reBEMTestUtils.isCompositeComponentWithBEM(instance, bemjson);
    });
};
{'fraction_non_alphanumeric': 0.11144945188794153, 'fraction_numerical': 0.001218026796589525, 'mean_word_length': 4.3, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2583384', 'n_tokens_mistral': 485, 'n_tokens_neox': 481, 'n_words': 81}