<commit_before>import browserslist from '../';

import test from 'ava';

const originUsage = browserslist.usage;

test.before(() => {
    browserslist.usage = {
        global: {
            'ie 9':  5,
            'ie 10': 10.1
        },
        UK: {
            'ie 9':  2,
            'ie 10': 4.4
        }
    };
});

test.after(() => {
    browserslist.usage = originUsage;
});

test('returns browsers coverage', t => {
    t.same(browserslist.coverage(['ie 9', 'ie 10']), 15.1);
});

test('returns zero coverage on empty browsers', t => {
    t.same(browserslist.coverage([]), 0);
});

test('returns usage in specified country', t => {
    t.same(browserslist.coverage(['ie 10'], 'uk'), 4.4);
});

test('loads country usage data from Can I Use', t => {
    t.ok(browserslist.coverage(['ie 9', 'ie 10'], 'us') > 0);
});<commit_msg>More tests for country coverage<commit_after>import browserslist from '../';

import test from 'ava';

const originUsage = browserslist.usage;

test.before(() => {
    browserslist.usage = {
        global: {
            'ie 9':  5,
            'ie 10': 10.1
        },
        UK: {
            'ie 9':  2,
            'ie 10': 4.4
        }
    };
});

test.after(() => {
    browserslist.usage = originUsage;
});

test('returns browsers coverage', t => {
    t.same(browserslist.coverage(['ie 9', 'ie 10']), 15.1);
});

test('returns zero coverage on empty browsers', t => {
    t.same(browserslist.coverage([]), 0);
});

test('returns usage in specified country', t => {
    t.same(browserslist.coverage(['ie 10'], 'UK'), 4.4);
});

test('accepts country in any case', t => {
    t.same(browserslist.coverage(['ie 10'], 'uk'), 4.4);
});

test('loads country usage data from Can I Use', t => {
    t.ok(browserslist.coverage(['ie 9', 'ie 10'], 'US') > 0);
});
{'fraction_non_alphanumeric': 0.19877845641310382, 'fraction_numerical': 0.03331482509716824, 'mean_word_length': 2.589641434262948, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 18, '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': '7414378', 'n_tokens_mistral': 668, 'n_tokens_neox': 618, 'n_words': 158}