<commit_before>var mysleep = require('sleep');
var chai = require('chai');
var parentDir = require('path');
var currentDir = parentDir.dirname(module.filename);
var Connection = require(parentDir.dirname(currentDir) + '/dist/api/connection').Connection
var StateType = require(parentDir.dirname(currentDir) + '/dist/api/api').StateType
var IRecipientInfo = require(parentDir.dirname(currentDir) + '/dist/api/api').IRecipientInfo
var path = parentDir.dirname(currentDir) + "/lib/libcxs.so";
var cxs = require('../dist/index.js')
var expect = chai.expect;
var assert = chai.assert;

// console.log(release(handle)) // tslint:disable-line
describe('A Connection object with ', function () {
    let connection;
    beforeEach(function() {
        const result = cxs.init_cxs('ENABLE_TEST_MODE')
        connection = new Connection(path)
    });

    //connection_create tests

    it('valid parameters in create should return success', function () {
        assert.equal(connection.create({
            id: "234",
            DIDself: "456",
            DIDremote: "0"}), 0)
    })

    it('null param in create should return success', function () {
        assert.equal(connection.create(null), 0)
    })


// connection_connect tests

    it(' a call to connect with connection already created should return success', function () {
        connection.create("connection_connect tests")
        mysleep.msleep(1000)
        assert.equal(connection.connect({sms: true}), 0)

    })

    it(' a call to create with no connection created should return unknown error', function () {
        assert.equal(connection.connect({sms: true}), 1003)
    })


// connection_get_data tests

    it('a call to get_data where connection exists should return back the connections data', function () {
        connection.create("dog, cat, man")
        var data = connection.getData()
        var jsonData = JSON.parse(data)
        assert.notEqual(data, null)
        assert.equal(jsonData.handle, connection.connectionHandle)
    })

    it('a call to get_data where connection doesnt exist should return a null value', function () {
        assert.equal(connection.getData(), null)
    })
<commit_msg>Increased sleep to 1500ms on connection connect<commit_after>var mysleep = require('sleep');
var chai = require('chai');
var parentDir = require('path');
var currentDir = parentDir.dirname(module.filename);
var Connection = require(parentDir.dirname(currentDir) + '/dist/api/connection').Connection
var StateType = require(parentDir.dirname(currentDir) + '/dist/api/api').StateType
var IRecipientInfo = require(parentDir.dirname(currentDir) + '/dist/api/api').IRecipientInfo
var path = parentDir.dirname(currentDir) + "/lib/libcxs.so";
var cxs = require('../dist/index.js')
var expect = chai.expect;
var assert = chai.assert;

// console.log(release(handle)) // tslint:disable-line
describe('A Connection object with ', function () {
    let connection;
    beforeEach(function() {
        const result = cxs.init_cxs('ENABLE_TEST_MODE')
        connection = new Connection(path)
    });

    //connection_create tests

    it('valid parameters in create should return success', function () {
        assert.equal(connection.create({
            id: "234",
            DIDself: "456",
            DIDremote: "0"}), 0)
    })

    it('null param in create should return success', function () {
        assert.equal(connection.create(null), 0)
    })


// connection_connect tests

    it(' a call to connect with connection already created should return success', function () {
        connection.create("connection_connect tests")
        mysleep.msleep(1500)
        assert.equal(connection.connect({sms: true}), 0)

    })

    it(' a call to create with no connection created should return unknown error', function () {
        assert.equal(connection.connect({sms: true}), 1003)
    })


// connection_get_data tests

    it('a call to get_data where connection exists should return back the connections data', function () {
        connection.create("dog, cat, man")
        var data = connection.getData()
        var jsonData = JSON.parse(data)
        assert.notEqual(data, null)
        assert.equal(jsonData.handle, connection.connectionHandle)
    })

    it('a call to get_data where connection doesnt exist should return a null value', function () {
        assert.equal(connection.getData(), null)
    })

{'fraction_non_alphanumeric': 0.12488646684831971, 'fraction_numerical': 0.009082652134423252, 'mean_word_length': 3.4182547642928784, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, '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': '1775860', 'n_tokens_mistral': 1250, 'n_tokens_neox': 1192, 'n_words': 334}