T.ME/BIBIL_0DAY
CasperSecurity


Server : Apache/2
System : Linux server-15-235-50-60 5.15.0-164-generic #174-Ubuntu SMP Fri Nov 14 20:25:16 UTC 2025 x86_64
User : gositeme ( 1004)
PHP Version : 8.2.29
Disable Function : exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
Directory :  /home/gositeme/domains/lavocat.quebec/private_html/node_modules/mammoth/test/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/gositeme/domains/lavocat.quebec/private_html/node_modules/mammoth/test/zipfile.tests.js
var assert = require("assert");

var JSZip = require("jszip");

var zipfile = require("../lib/zipfile");
var test = require("./test")(module);

test('file in zip can be read after being written', function() {
    return emptyZipFile().then(function(zip) {
        assert(!zip.exists("song/title"));

        zip.write("song/title", "Dark Blue");

        assert(zip.exists("song/title"));
        return zip.read("song/title", "utf8").then(function(contents) {
            assert.equal(contents, "Dark Blue");
        });
    });
});

function emptyZipFile() {
    var zip = new JSZip();
    return zip.generateAsync({type: "arraybuffer"}).then(function(arrayBuffer) {
        return zipfile.openArrayBuffer(arrayBuffer);
    });
}


test("splitPath splits zip paths on last forward slash", function() {
    assert.deepEqual(zipfile.splitPath("a/b"), {dirname: "a", basename: "b"});
    assert.deepEqual(zipfile.splitPath("a/b/c"), {dirname: "a/b", basename: "c"});
    assert.deepEqual(zipfile.splitPath("/a/b/c"), {dirname: "/a/b", basename: "c"});
});


test("when path has no forward slashes then splitPath returns empty dirname", function() {
    assert.deepEqual(zipfile.splitPath("name"), {dirname: "", basename: "name"});
});


test("joinPath joins arguments with forward slashes", function() {
    assert.equal(zipfile.joinPath("a", "b"), "a/b");
    assert.equal(zipfile.joinPath("a/b", "c"), "a/b/c");
    assert.equal(zipfile.joinPath("a", "b/c"), "a/b/c");
    assert.equal(zipfile.joinPath("/a/b", "c"), "/a/b/c");
});


test("empty parts are ignored when joining paths", function() {
    assert.equal(zipfile.joinPath("a", ""), "a");
    assert.equal(zipfile.joinPath("", "b"), "b");
    assert.equal(zipfile.joinPath("a", "", "b"), "a/b");
});


test("when joining paths then absolute paths ignore earlier paths", function() {
    assert.equal(zipfile.joinPath("a", "/b"), "/b");
    assert.equal(zipfile.joinPath("a", "/b", "c"), "/b/c");
    assert.equal(zipfile.joinPath("/a", "/b"), "/b");
    assert.equal(zipfile.joinPath("/a"), "/a");
});

CasperSecurity Mini