<commit_before>var fs = require('fs');
eval(fs.readFileSync('../knwl.js') + '');

var x = new Knwl();
var ValidEmails = [
    "<EMAIL>",
    "<EMAIL>",
    "<EMAIL>",
    "<EMAIL>",
    "<EMAIL>",
    "<EMAIL>",
    "<EMAIL>",
    "<EMAIL>",
    "test@10.0.0.1",
    "<EMAIL>",
    "<EMAIL>"
];

var InvalidEmails = [
    <EMAIL>",
    "@",
    "what",
    "",
    <EMAIL>",
    "<EMAIL>",
    "あいうえ<EMAIL>"
];


describe("email", function() {
    for (var i = ValidEmails.length - 1; i >= 0; i--) {
        var ve = ValidEmails[i];
        it("should detect the valid email of " + ve, function() {
            x.init("You can reach me on " + ve);
            var output = x.get("emails")
            expect(output[0][0]).toBe(ve);
        });
    };

    // Uncomment me when issue #35 is solved
    // for (var i = ValidEmails.length - 1; i >= 0; i--) {
    //     var ve = ValidEmails[i];
    //     it("should detect the valid email of " + ve + " that ends in a full stop", function() {
    //         x.init("You can reach me on " + ve + ".");
    //         var output = x.get("emails")
    //         expect(output[0][0]).toBe(ve);
    //     });
    // };

    for (var i = InvalidEmails.length - 1; i >= 0; i--) {
        var ie = InvalidEmails[i];
        it("should not detect the email of " + ie, function() {
            x.init("You can reach me on " + ie);
            var output = x.get("emails")
            expect(output.length).toBe(0);
        });
    };

    var mailchain = ""
    for (var i = ValidEmails.length - 1; i >= 0; i--) {
        mailchain = mailchain + " " + ValidEmails[i];
    };

    it("Testing all valid emails in one string", function() {
        x.init("You can reach me on " + mailchain);
        var output = x.get("emails")
        expect(output.length).toBe(ValidEmails.length);
    });

    it("Testing all valid emails in one string comma seperated", function() {
        x.init("You can reach me on " + ValidEmails.join());
        var output = x.get("emails")
        expect(output.length).toBe(ValidEmails.length);
    });

    it("should detect if there are two emails seperated by commas", function() {
        x.init("-David (<EMAIL>),Wilson(<EMAIL>)");
        var output = x.get("emails")
        expect(output.length).toBe(2);
    });<commit_msg>modify regex and get to a point that does not break any of the existing tests (#35)<commit_after>var fs = require('fs');
eval(fs.readFileSync('../knwl.js') + '');

var x = new Knwl();
var ValidEmails = [
    "<EMAIL>",
    "<EMAIL>",
    "<EMAIL>",
    "<EMAIL>",
    "<EMAIL>",
    "<EMAIL>",
    "<EMAIL>",
    "123<EMAIL>",
    "test@10.0.0.1",
    "<EMAIL>",
    "<EMAIL>"
];

var InvalidEmails = [
    <EMAIL>",
    "@",
    "what",
    "",
    <EMAIL>",
    "test@test",
    "あいう<EMAIL>"
];


describe("email", function() {
    for (var i = ValidEmails.length - 1; i >= 0; i--) {
        var ve = ValidEmails[i];
        it("should detect the valid email of " + ve, function() {
            x.init("You can reach me on " + ve);
            var output = x.get("emails")
            expect(output[0][0]).toBe(ve);
        });
    };

    // Uncomment me when issue #35 is solved
    // for (var i = ValidEmails.length - 1; i >= 0; i--) {
    //     var ve = ValidEmails[i];
    //     it("should detect the valid email of " + ve + " that ends in a full stop", function() {
    //         x.init("You can reach me on " + ve + ".");
    //         var output = x.get("emails")
    //         expect(output[0][0]).toBe(ve);
    //     });
    // };

    for (var i = InvalidEmails.length - 1; i >= 0; i--) {
        var ie = InvalidEmails[i];
        it("should not detect the email of " + ie, function() {
            x.init("You can reach me on " + ie);
            var output = x.get("emails")
            expect(output.length).toBe(0);
        });
    };

    var mailchain = ""
    for (var i = ValidEmails.length - 1; i >= 0; i--) {
        mailchain = mailchain + " " + ValidEmails[i];
    };

    it("Testing all valid emails in one string", function() {
        x.init("You can reach me on " + mailchain);
        var output = x.get("emails")
            console.log("MESSAGE :")
            console.log("You can reach me on " + mailchain);
            console.log("EMAILS :");
            console.log(output);
        expect(output.length).toBe(ValidEmails.length);
    });

    it("Testing all valid emails in one string comma seperated", function() {
        x.init("You can reach me on " + ValidEmails.join());
        var output = x.get("emails")
        expect(output.length).toBe(ValidEmails.length);
    });

    it("should detect if there are two emails seperated by commas", function() {
        x.init("-David (<EMAIL>),Wilson(<EMAIL>)");
        var output = x.get("emails")
        expect(output.length).toBe(2);
    });
{'fraction_non_alphanumeric': 0.18455821635012387, 'fraction_numerical': 0.009702725020644096, 'mean_word_length': 2.0168119551681194, 'pattern_counts': {'":': 0, '<': 34, '<?xml version=': 0, '>': 42, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, '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': '4184815', 'n_tokens_mistral': 1626, 'n_tokens_neox': 1608, 'n_words': 421}