<commit_before>/*
 * Tests for k.getQueryParamsAsDict()
 */

$(document).ready(function(){

// Object.keys() shim
if (!Object.keys) {
    Object.keys = function keys(object) {
        var keys = [];
        for (var name in object) {
            if (object.hasOwnProperty(name)) {
                keys.push(name);
            }
        }
        return keys;
    };
}

module('k.getQueryParamsAsDict');

test('no params', function() {
    var queryString = '',
        params = k.getQueryParamsAsDict(queryString);
    equals(0, Object.keys(params).length);
});

test('one param', function() {
    var queryString = 'http://example.com/?test=woot',
        params = k.getQueryParamsAsDict(queryString);
    equals(1, Object.keys(params).length);
    equals('woot', params['test']);
});

test('two params', function() {
    var queryString = 'http://example.com/?x=foo&y=bar',
        params = k.getQueryParamsAsDict(queryString);
    equals(2, Object.keys(params).length);
    equals('foo', params['x']);
    equals('bar', params['y']);
});

test('google url', function() {
    var queryString = 'http://www.google.com/url?sa=t&source=web&cd=1&sqi=2&ved=0CDEQFjAA&url=http%3A%2F%2Fsupport.mozilla.com%2F&rct=j&q=firefox%20help&ei=OsBSTpbZBIGtgQfgzv3yBg&usg=AFQjCNFIV7wgd9Pnr0m3Ofc7r1zVTNK8dw',
        params = k.getQueryParamsAsDict(queryString);
    equals(10, Object.keys(params).length);
    equals('firefox help', params['q']);
});

});<commit_msg>Pass parameters in expected order to `equals()` in js tests. Made the "no params" test use valid data and hoping it fixes jenkins.<commit_after>/*
 * Tests for k.getQueryParamsAsDict()
 */

$(document).ready(function(){

// Object.keys() shim
if (!Object.keys) {
    Object.keys = function keys(object) {
        var keys = [];
        for (var name in object) {
            if (object.hasOwnProperty(name)) {
                keys.push(name);
            }
        }
        return keys;
    };
}

module('k.getQueryParamsAsDict');

test('no params', function() {
    var url = 'http://example.com/',
        params = k.getQueryParamsAsDict(url);
    equals(Object.keys(params).length, 0);
});

test('one param', function() {
    var url = 'http://example.com/?test=woot',
        params = k.getQueryParamsAsDict(url);
    equals(Object.keys(params).length, 1);
    equals('woot', params['test']);
});

test('two params', function() {
    var url = 'http://example.com/?x=foo&y=bar',
        params = k.getQueryParamsAsDict(url);
    equals(Object.keys(params).length, 2);
    equals('foo', params['x']);
    equals('bar', params['y']);
});

test('google url', function() {
    var url = 'http://www.google.com/url?sa=t&source=web&cd=1&sqi=2&ved=0CDEQFjAA&url=http%3A%2F%2Fsupport.mozilla.com%2F&rct=j&q=firefox%20help&ei=OsBSTpbZBIGtgQfgzv3yBg&usg=AFQjCNFIV7wgd9Pnr0m3Ofc7r1zVTNK8dw',
        params = k.getQueryParamsAsDict(url);
    equals(Object.keys(params).length, 10);
    equals('firefox help', params['q']);
});

});
{'fraction_non_alphanumeric': 0.18099395567494964, 'fraction_numerical': 0.014775016789791807, 'mean_word_length': 3.548091603053435, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '6026964', 'n_tokens_mistral': 1063, 'n_tokens_neox': 1042, 'n_words': 169}