<commit_before>"use strict";
var select, xmldsig, DOMParser, XMLSerializer, readXml, assert, XmlCore;

if (typeof module !== "undefined") {
    var config = require("../config");
    var xmljs = require("xml-core");
    select = config.select;
    xmldsig = config.xmldsig;
    DOMParser = config.DOMParser;
    XMLSerializer = config.XMLSerializer;
    assert = config.assert;
    readXml = config.readXml;
    XmlCore = config.XmlCore;
}

describe("Key", function () {

    function isNode() {
        if (typeof window === "undefined") {
            warn("NodeJS");
            return true;
        }
        return false;
    }

    function warn(name) {
        console.warn("    \x1b[33mWARN:\x1b[0m Test is not supported for %s", name);
    }

    context("X509Certificate", () => {

        let cert = null;

        it("Init without params", () => {
            let cert = new xmldsig.X509Certificate();
        });


        it("Init with raw", () => {
            const certBase64 = "<KEY>;
            cert = new xmldsig.X509Certificate(XmlCore.Convert.FromBase64(certBase64));
            assert.equal(!!cert.simpl, true);
        });

        it("Serial number", () => {
            assert.equal(!!cert, true, "Certificate is null");

            assert.equal(cert.SerialNumber, "00a3fcc4b7b76e646d");
        });

        it("Issue/Subject names", () => {
            assert.equal(!!cert, true, "Certificate is null");

            assert.equal(cert.Issuer, "C=AT, O=Rundfunk und Telekom Regulierungs-GmbH, CN=Trusted List CA 1");
            assert.equal(cert.Subject, "C=AT, O=Rundfunk und Telekom Regulierungs-GmbH, CN=Trusted List 5");<commit_msg>Fix test error<commit_after>"use strict";
var select, xmldsig, DOMParser, XMLSerializer, readXml, assert, XmlCore;

if (typeof module !== "undefined") {
    var config = require("../config");
    var xmljs = require("xml-core");
    select = config.select;
    xmldsig = config.xmldsig;
    DOMParser = config.DOMParser;
    XMLSerializer = config.XMLSerializer;
    assert = config.assert;
    readXml = config.readXml;
    XmlCore = config.XmlCore;
}

describe("Key", function () {

    function isNode() {
        if (typeof window === "undefined") {
            warn("NodeJS");
            return true;
        }
        return false;
    }

    function warn(name) {
        console.warn("    \x1b[33mWARN:\x1b[0m Test is not supported for %s", name);
    }

    context("X509Certificate", () => {

        let cert = null;

        it("Init without params", () => {
            let cert = new xmldsig.X509Certificate();
        });


        it("Init with raw", () => {
            const certBase64 = "<KEY>;
            cert = new xmldsig.X509Certificate(XmlCore.Convert.FromBase64(certBase64));
            assert.equal(!!cert.simpl, true);
        });

        it("Serial number", () => {
            assert.equal(!!cert, true, "Certificate is null");

            assert.equal(cert.SerialNumber, "11816535815648863341");
        });

        it("Issue/Subject names", () => {
            assert.equal(!!cert, true, "Certificate is null");

            assert.equal(cert.Issuer, "C=AT, O=Rundfunk und Telekom Regulierungs-GmbH, CN=Trusted List CA 1");
            assert.equal(cert.Subject, "C=AT, O=Rundfunk und Telekom Regulierungs-GmbH, CN=Trusted List 5");
{'fraction_non_alphanumeric': 0.14572713643178412, 'fraction_numerical': 0.022188905547226388, 'mean_word_length': 2.40755873340143, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 14}, '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': '5406603', 'n_tokens_mistral': 1102, 'n_tokens_neox': 1013, 'n_words': 231}