let assert = require('assert');
import MockObjects from "../mockObjects";
import RedisMock from "../mocks/redisMock";
import CassandraMock from "../mocks/cassandraMock";
import * as Bluebird from "bluebird";
import * as Cassandra from "cassandra-driver";

let redisConfig = {
    statusCheckInterval: 1,
    keys: {
        rediskey_connections: "test:"
    }
};

describe('test mock objects', function () {
    it('test redis change', function (done) {
        class SpecialCase extends RedisMock {
            public quit(callback?: (err: Error, res: string) => void): Bluebird<string> {
                done();
                return super.quit();
            } 
        }

        let redis = MockObjects.makeRedis(redisConfig, SpecialCase);
        redis.close();
    });
    it('test cassandra change', function (done) {
        class SpecialCase extends CassandraMock {
            public shutdown(callback?: Cassandra.Callback): void {
                done();
            } 
        }

        let cassa = MockObjects.makeCassandra({autoConnect: true}, SpecialCase);
        cassa.close();
    });      
});    