<commit_before>const browserslist = require('browserslist');
const Browsers     = require('../lib/browsers');
const Prefixes     = require('../lib/prefixes');
const info         = require('../lib/info');

const data = {
    browsers: require('caniuse-lite').agents,
    prefixes: {
        'a': {
            browsers: ['firefox 21', 'firefox 20', 'chrome 30'],
            transition: true
        },
        'b': {
            browsers: ['ie 6', 'firefox 20'],
            props:    ['a', '*']
        },
        'c': {
            browsers: ['firefox 21'],
            props:    ['c']
        },
        'd': {
            browsers: ['firefox 21'],
            selector:   true
        },
        '@keyframes': {
            browsers: ['firefox 21']
        },
        'transition': {
            browsers: ['firefox 21']
        }
    }
};

describe('info', () => {

    it('returns selected browsers and prefixes', () => {
        const browsers = new Browsers(data.browsers,
      ['chrome 30', 'firefox 21', 'firefox 20', 'ie 6']);
        const prefixes = new Prefixes(data.prefixes, browsers);

        const coverage = browserslist.coverage(
      ['chrome 30', 'firefox 21', 'firefox 20', 'ie 6']);
        const round = Math.round(coverage * 100) / 100.0;

        return info(prefixes).should.eql('Browsers:\n' +
                              '  Chrome: 30\n' +
                              '  Firefox: 21, 20\n' +
                              '  IE: 6\n' +
                              '\n' +
                              `These browsers account for ${round}% ` +
                                'of all users globally\n' +
                              '\n' +
                              'At-Rules:\n' +
                              '  @keyframes: moz\n' +
                              '\n' +
                              'Selectors:\n' +
                              '  d: moz\n' +
                              '\n' +
                              'Properties:\n' +
                              '  a: webkit, moz\n' +
                              '  transition: moz\n' +
                              '\n' +
                              'Values:\n' +
                              '  b: moz, ms\n' +
                              '  c: moz\n'
    );
    });

    it('doesn\'t show transitions unless they are necessary', () => {
        const browsers = new Browsers(data.browsers, ['chrome 30', 'firefox 20', 'ie 6']);
        const prefixes = new Prefixes(data.prefixes, browsers);

        const coverage = browserslist.coverage(['chrome 30', 'firefox 20', 'ie 6']);
        const round    = Math.round(coverage * 100) / 100.0;

        return info(prefixes).should.eql('Browsers:\n' +
                              '  Chrome: 30\n' +
                              '  Firefox: 20\n' +
                              '  IE: 6\n' +
                              '\n' +
                              `These browsers account for ${ round }% ` +
                                'of all users globally\n' +
                              '\n' +
                              'Properties:\n' +
                              '  a: webkit, moz\n' +
                              '\n' +
                              'Values:\n' +
                              '  b: moz, ms\n'
    );
    });

    it('returns string for empty prefixes', () => {
        const browsers = new Browsers(data.browsers, ['ie 7']);
        const prefixes = new Prefixes(data.prefixes, browsers);

        return info(prefixes).should.match(/remove Autoprefixer/);
    });

    return it('returns string for empty browsers', () => {
        const browsers = new Browsers(data.browsers, []);
        const prefixes = new Prefixes(data.prefixes, browsers);

        return info(prefixes).should.eql('No browsers selected');
    });
});<commit_msg>Fix test/info.js<commit_after>const browserslist = require('browserslist');
const Browsers     = require('../lib/browsers');
const Prefixes     = require('../lib/prefixes');
const info         = require('../lib/info');

const data = {
    browsers: require('caniuse-lite').agents,
    prefixes: {
        'a': {
            browsers: ['firefox 21', 'firefox 20', 'chrome 30'],
            transition: true
        },
        'b': {
            browsers: ['ie 6', 'firefox 20'],
            props:    ['a', '*']
        },
        'c': {
            browsers: ['firefox 21'],
            props:    ['c']
        },
        'd': {
            browsers: ['firefox 21'],
            selector:   true
        },
        '@keyframes': {
            browsers: ['firefox 21']
        },
        'transition': {
            browsers: ['firefox 21']
        }
    }
};

describe('info', () => {

    it('returns selected browsers and prefixes', () => {
        const browsers = new Browsers(data.browsers,
            ['chrome 30', 'firefox 21', 'firefox 20', 'ie 6']);
        const prefixes = new Prefixes(data.prefixes, browsers);

        const coverage = browserslist.coverage(
            ['chrome 30', 'firefox 21', 'firefox 20', 'ie 6']);
        const round = Math.round(coverage * 100) / 100.0;

        info(prefixes).should.eql(
            'Browsers:\n' +
            '  Chrome: 30\n' +
            '  Firefox: 21, 20\n' +
            '  IE: 6\n' +
            '\n' +
            `These browsers account for ${round}% ` +
            'of all users globally\n' +
            '\n' +
            'At-Rules:\n' +
            '  @keyframes: moz\n' +
            '\n' +
            'Selectors:\n' +
            '  d: moz\n' +
            '\n' +
            'Properties:\n' +
            '  a: webkit, moz\n' +
            '  transition: moz\n' +
            '\n' +
            'Values:\n' +
            '  b: moz, ms\n' +
            '  c: moz\n'
        );
    });

    it('doesn\'t show transitions unless they are necessary', () => {
        const browsers = new Browsers(data.browsers,
            ['chrome 30', 'firefox 20', 'ie 6']);
        const prefixes = new Prefixes(data.prefixes, browsers);

        const coverage = browserslist.coverage(
            ['chrome 30', 'firefox 20', 'ie 6']);
        const round    = Math.round(coverage * 100) / 100.0;

        info(prefixes).should.eql(
            'Browsers:\n' +
            '  Chrome: 30\n' +
            '  Firefox: 20\n' +
            '  IE: 6\n' +
            '\n' +
            `These browsers account for ${ round }% ` +
            'of all users globally\n' +
            '\n' +
            'Properties:\n' +
            '  a: webkit, moz\n' +
            '\n' +
            'Values:\n' +
            '  b: moz, ms\n'
        );
    });

    it('returns string for empty prefixes', () => {
        const browsers = new Browsers(data.browsers, ['ie 7']);
        const prefixes = new Prefixes(data.prefixes, browsers);
        info(prefixes).should.match(/remove Autoprefixer/);
    });

    it('returns string for empty browsers', () => {
        const browsers = new Browsers(data.browsers, []);
        const prefixes = new Prefixes(data.prefixes, browsers);
        info(prefixes).should.eql('No browsers selected');
    });

});
{'fraction_non_alphanumeric': 0.15089585666293392, 'fraction_numerical': 0.019036954087346025, 'mean_word_length': 1.24756212645486, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 16, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5470523', 'n_tokens_mistral': 2255, 'n_tokens_neox': 2076, 'n_words': 471}