swagger-ui-lite (2018.8.11)

Code coverage report for node-swagger-ui-lite/test.js

Ignored Statements Branches Functions Lines
none 100%
(49 / 49)
100%
(16 / 16)
100%
(10 / 10)
100%
(49 / 49)
All files » node-swagger-ui-lite/ » test.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155                        2   2         2   2   2         2       2     2           2 2       2 1 1   1 1 1 1 1 1     1 1                 7   1     1 1                                                         12 11   1     1 1 36 20     1 1 1 1 1 1       1     2       2 1 1   1 1 1 1 1                   1          
/* istanbul instrument in package swagger_ui */
/* jslint-utility2 */
/*jslint
    bitwise: true,
    browser: true,
    maxerr: 4,
    maxlen: 100,
    node: true,
    nomen: true,
    regexp: true,
    stupid: true
*/
(function () {
    'use strict';
    var local;
 
 
 
    // run shared js-env code - init-before
    (function () {
        // init local
        local = {};
        // init isBrowser
        local.isBrowser = typeof window === "object" &&
            typeof window.XMLHttpRequest === "function" &&
            window.document &&
            typeof window.document.querySelectorAll === "function";
        // init global
        local.global = local.isBrowser
            ? window
            : global;
        // re-init local
        local = local.global.local = (local.global.utility2 ||
            require('utility2')).requireReadme();
        // init test
        local.testRunInit(local);
    }());
 
 
 
    // run shared js-env code - function
    (function () {
        local.testCase_buildApidoc_default = function (options, onError) {
        /*
         * this function will test buildApidoc's default handling-behavior-behavior
         */
            if (local.isBrowser) {
                onError(null, options);
                return;
            }
            options = {};
            options.global = local.objectSetDefault({}, local.global);
            options.polyfill = function () {
                var $, Backbone, Handlebars, window;
                $ = Backbone = Handlebars = function (arg0) {
                    return arg0;
                };
                // jslint-hack
                $(Backbone, Handlebars, window);
                [
                    'Collection',
                    'Model',
                    'Router',
                    'View',
                    'extend',
                    'registerHelper',
                    'template'
                ].forEach(function (key) {
                    $[key] = $;
                });
                window = global;
            };
            // coverage-hack
            options.polyfill();
            local.vm.runInThisContext(local.jslintAndPrint(
/* jslint-ignore-begin */
'\
/*jslint\n\
    node: true\n\
*/\n\
"use strict";\n\
var $, Backbone, Handlebars, window;\n\
$ = Backbone = Handlebars = function (arg0) {\n\
    return arg0;\n\
};\n\
// jslint-hack\n\
$(Backbone, Handlebars, window);\n\
[\n\
    "Collection",\n\
    "Model",\n\
    "Router",\n\
    "View",\n\
    "extend",\n\
    "registerHelper",\n\
    "template"\n\
].forEach(function (key) {\n\
    $[key] = $;\n\
});\n\
window = global;\n\
', 'polyfill.js'
/* jslint-ignore-end */
            ) + local.fs.readFileSync('assets.swagger_ui.rollup.js', 'utf8')
                    .replace((/^\/\/ init lib [\S\s]*?\n\n\n\n/gm), function (match0) {
                    if (match0.indexOf('init lib swagger') < 0) {
                        return '';
                    }
                    return match0;
                })
                );
            options.exports = local.objectSetDefault({}, local.global);
            Object.keys(options.exports).forEach(function (key) {
                if (options.exports[key] === options.global[key]) {
                    delete options.exports[key];
                }
            });
            delete options.exports.$.Backbone;
            delete options.exports.$.Handlebars;
            delete options.exports.Backbone;
            delete options.exports.Handlebars;
            delete options.exports.$;
            options.moduleDict = {
                exampleFileList: ['assets.swagger_ui.rollup.js'],
                swagger_ui: { exports: options.exports }
            };
            local.buildApidoc(options, onError);
        };
 
        local.testCase_buildApp_default = function (options, onError) {
        /*
         * this function will test buildApp's default handling-behavior-behavior
         */
            if (local.isBrowser) {
                onError(null, options);
                return;
            }
            local.testCase_buildReadme_default(options, local.onErrorThrow);
            local.testCase_buildLib_default(options, local.onErrorThrow);
            local.testCase_buildTest_default(options, local.onErrorThrow);
            local.testCase_buildCustomOrg_default(options, local.onErrorThrow);
            options = { assetsList: [{
                file: '/assets.swagger_ui.html',
                url: '/assets.swagger_ui.html'
            }, {
                file: '/assets.swagger_ui.petstore.json',
                url: '/assets.swagger_ui.petstore.json'
            }, {
                file: '/assets.swagger_ui.rollup.js',
                url: '/assets.swagger_ui.rollup.js'
            }] };
            local.buildApp(options, onError);
        };
    }());
}());