<commit_before>(function() {
    'use strict';
    
    var DIR                 = __dirname + '/../../',
        LIBDIR              = DIR + 'lib/',
        HTMLDIR             = DIR + 'html/',
        
        Util                = require(LIBDIR + 'util'),
        CloudFunc           = require(LIBDIR + 'cloudfunc'),
        files               = require(LIBDIR + 'server/files'),
        
        FS_DIR              = HTMLDIR   + 'fs/',
        EXPECT_PATH         = DIR       + 'test/lib/cloudfunc.html',
        
        TMPL_PATH   = [
            'file',
            'path',
            'pathLink',
            'link',
        ],
        
        JSON_FILES          = {
            path  : '/etc/X11/', 
            files : [{
                name: 'applnk',
                size: 'dir',
                uid : 0,
                mode: '40755'
            }, {
                name: 'prefdm',
                size: 1328,
                uid : 0,
                mode: '100755'
            }]
        },
        
        Expect =
            '<div data-name="js-path" class="reduce-text" title="/etc/X11/">'   +
                '<span data-name="js-clear-storage" class="path-icon clear-storage" '   +
                    'title="clear storage (Ctrl+D)">'                           +
                '</span>'                                                       +
                '<a data-name="js-refresh" href="/fs/etc/X11" '                 +
                'class="path-icon refresh-icon" title="refresh (Ctrl+R)"></a>'  +
                '<span data-name="js-links" class=links>'                       +
                    '<a data-name="js-path-link" href="/fs/" title="/">/</a>'   +
                    '<a data-name="js-path-link" href="/fs/etc/" title="/etc/">'+
                        'etc'                                                   +
                    '</a>/X11/'                                                 +
                '</span>'                                                       +
            '</div>';
    
    exports.check = function() {
        var paths       = {},
            
            filesList   = TMPL_PATH.map(function(name) {
                var path = FS_DIR + name + '.html';
                
                paths[path] = name;
                
                return path;
            })
            .concat(EXPECT_PATH);
        
        files.read(filesList, 'utf8', function(errors, files) {
            var isNotOk, expect, result,
                i           = 0,
                template    = {};
            
            if (errors) {
                throw(console.log(errors));
            } else {
                Util.time('CloudFunc.buildFromJSON');
                
                Object.keys(files).forEach(function(path) {
                    var name = paths[path];
                    
                    if (path !== EXPECT_PATH)
                        template[name] = files[path];
                });
                
                expect          = files[EXPECT_PATH];
                
                result          = CloudFunc.buildFromJSON({
                    data    : JSON_FILES,
                    template: template
                });
                
                Expect          += expect;
                
                isNotOk = Util.slice(Expect).some(function(item, number) {
                    var ret = result[number] !== item;
                    
                    if (ret)
                        i = number;
                    
                    return ret;
                });
                
                Util.timeEnd('CloudFunc.buildFromJSON');
                
                if (isNotOk) {
                    console.log('Error in char number: ' + i    + '\n' +
                                'Expect: ' + Expect.substr(i)  + '\n' +
                                'Result: ' + result.substr(i) );
                    
                    throw('buildFromJSON: Not OK');
                }
            }
        });
    };
})();
<commit_msg>test(cloudfunc) change size<commit_after>(function() {
    'use strict';
    
    var DIR                 = __dirname + '/../../',
        LIBDIR              = DIR + 'lib/',
        HTMLDIR             = DIR + 'html/',
        
        Util                = require(LIBDIR + 'util'),
        CloudFunc           = require(LIBDIR + 'cloudfunc'),
        files               = require(LIBDIR + 'server/files'),
        
        FS_DIR              = HTMLDIR   + 'fs/',
        EXPECT_PATH         = DIR       + 'test/lib/cloudfunc.html',
        
        TMPL_PATH   = [
            'file',
            'path',
            'pathLink',
            'link',
        ],
        
        JSON_FILES          = {
            path  : '/etc/X11/', 
            files : [{
                name: 'applnk',
                size: 'dir',
                uid : 0,
                mode: '40755'
            }, {
                name: 'prefdm',
                size: '1.30kb',
                uid : 0,
                mode: '100755'
            }]
        },
        
        Expect =
            '<div data-name="js-path" class="reduce-text" title="/etc/X11/">'   +
                '<span data-name="js-clear-storage" class="path-icon clear-storage" '   +
                    'title="clear storage (Ctrl+D)">'                           +
                '</span>'                                                       +
                '<a data-name="js-refresh" href="/fs/etc/X11" '                 +
                'class="path-icon refresh-icon" title="refresh (Ctrl+R)"></a>'  +
                '<span data-name="js-links" class=links>'                       +
                    '<a data-name="js-path-link" href="/fs/" title="/">/</a>'   +
                    '<a data-name="js-path-link" href="/fs/etc/" title="/etc/">'+
                        'etc'                                                   +
                    '</a>/X11/'                                                 +
                '</span>'                                                       +
            '</div>';
    
    exports.check = function() {
        var paths       = {},
            
            filesList   = TMPL_PATH.map(function(name) {
                var path = FS_DIR + name + '.html';
                
                paths[path] = name;
                
                return path;
            })
            .concat(EXPECT_PATH);
        
        files.read(filesList, 'utf8', function(errors, files) {
            var isNotOk, expect, result,
                i           = 0,
                template    = {};
            
            if (errors) {
                throw(console.log(errors));
            } else {
                Util.time('CloudFunc.buildFromJSON');
                
                Object.keys(files).forEach(function(path) {
                    var name = paths[path];
                    
                    if (path !== EXPECT_PATH)
                        template[name] = files[path];
                });
                
                expect          = files[EXPECT_PATH];
                
                result          = CloudFunc.buildFromJSON({
                    data    : JSON_FILES,
                    template: template
                });
                
                Expect          += expect;
                
                isNotOk = Util.slice(Expect).some(function(item, number) {
                    var ret = result[number] !== item;
                    
                    if (ret)
                        i = number;
                    
                    return ret;
                });
                
                Util.timeEnd('CloudFunc.buildFromJSON');
                
                if (isNotOk) {
                    console.log('Error in char number: ' + i    + '\n' +
                                'Expect: ' + Expect.substr(i)  + '\n' +
                                'Result: ' + result.substr(i) );
                    
                    throw('buildFromJSON: Not OK');
                }
            }
        });
    };
})();

{'fraction_non_alphanumeric': 0.12093421374419173, 'fraction_numerical': 0.006480802152115431, 'mean_word_length': 0.7211700336700336, 'pattern_counts': {'":': 0, '<': 27, '<?xml version=': 0, '>': 27, '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': '474827', 'n_tokens_mistral': 2058, 'n_tokens_neox': 1913, 'n_words': 338}