<commit_before>
'use strict';

/**
 * Checks to see if the url is external
 */
QUnit.test( 'smoothStateUtility: isExternal', function( assert ) {
    var externalUrls = [
            'http://www.google.com',
            '//www.google.com',
            '//google.com',
            '//google.com#hash'
        ],
        internalUrls = [
            'index.html',
            '/index.html',
            '/index.html#hash',
            '#hash'
        ],
        i, y;

    // Is external
    for (i = externalUrls.length - 1; i >= 0; i--) {
        assert.ok( $.smoothStateUtility.isExternal(externalUrls[i]) === true, 'External: ' + externalUrls[i] );
    }

    // Is not external
    for ( y = internalUrls.length - 1; y >= 0; y--) {
        assert.ok( $.smoothStateUtility.isExternal(internalUrls[y]) === false, 'Internal: ' + internalUrls[y] );
    }

});

/**
 * Checks to see if we should be loading this URL
 */<commit_msg>Add unit test for isHash.<commit_after>
'use strict';

/**
 * Checks to see if the url is external
 */
QUnit.test( 'smoothStateUtility: isExternal', function( assert ) {
    var externalUrls = [
            'http://www.google.com',
            '//www.google.com',
            '//google.com',
            '//google.com#hash'
        ],
        internalUrls = [
            'index.html',
            '/index.html',
            '/index.html#hash',
            '#hash'
        ],
        i, y;

    // Is external
    for (i = externalUrls.length - 1; i >= 0; i--) {
        assert.ok( $.smoothStateUtility.isExternal(externalUrls[i]) === true, 'External: ' + externalUrls[i] );
    }

    // Is not external
    for ( y = internalUrls.length - 1; y >= 0; y--) {
        assert.ok( $.smoothStateUtility.isExternal(internalUrls[y]) === false, 'Internal: ' + internalUrls[y] );
    }

});

/**
 * Checks to see if the url is a hash to the same page
 */
QUnit.test( 'smoothStateUtility: isHash', function( assert ) {
    var hashes = [
            $('<a href="#foo" />').prop('href'),
            $('<a href="' + window.location.href + '#foo" />').prop('href')
        ],
        nonHashes = [
            $('<a href="/other/page.html" />').prop('href'),
            $('<a href="/other/page.html#foo" />').prop('href')
        ],
        i, y;

    // Is external
    for (i = hashes.length - 1; i >= 0; i--) {
        assert.ok( $.smoothStateUtility.isHash(hashes[i]) === true, 'Hash: ' + hashes[i] );
    }

    // Is not external
    for ( y = nonHashes.length - 1; y >= 0; y--) {
        assert.ok( $.smoothStateUtility.isHash(nonHashes[y]) === false, 'Non hash: ' + nonHashes[y] );
    }

    // Passing in current href
    assert.ok( $.smoothStateUtility.isHash(nonHashes[1], nonHashes[0]) === true, 'Passed in current href' );

});

/**
 * Checks to see if we should be loading this URL
 */
{'fraction_non_alphanumeric': 0.18375310393756653, 'fraction_numerical': 0.004966300106420717, 'mean_word_length': 1.9497907949790796, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, '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': '6417121', 'n_tokens_mistral': 939, 'n_tokens_neox': 926, 'n_words': 219}