"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
let assert = require('assert');
const cassandra_1 = require("../cassandra");
const defaultOptions = require("../../options.json");
const settings_1 = require("../settings");
describe('cassandra', function () {
    it("reconnect test", function (done) {
        this.timeout(1000);
        let first = true;
        settings_1.default.Instance.setCassandra("test", { hosts: ["localhost"], port: 2201, autoConnect: true });
        let cassandra = new cassandra_1.default("test");
        assert.equal(cassandra.getStatus(), "", "default status value");
        let controlConnection = cassandra.getControlConnection();
        assert.notEqual(controlConnection, null);
        controlConnection.on("newConnection", function (err, connection, host) {
            if (first) {
                assert.equal(cassandra.getStatus(), "Error", "error status");
                first = false;
                if (controlConnection)
                    controlConnection.emit("newConnection", null);
            }
            else {
                assert.equal(cassandra.getStatus(), "Reconnected", "reconnected status");
                done();
            }
        });
    });
});
//# sourceMappingURL=test-cassandra.js.map