Skip to content

kennethklee/node-cassandra-driver-mock

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

node-cassandra-driver-mock

Basic mocking of cassandra-driver node module. Really, it just records the total number of requests and connections made.

install

npm install -save-dev cassandra-driver-mock

usage

// Mock must be required before cassandra-driver.
var cassandraMock = require('cassandra-driver-mock');

var Cassandra = require('cassandra-driver').Client;

var cassandra = new Cassandra({contactPoints: ['localhost'], keyspace: 'keyspace1'});
cassandra.execute('SOME QUERY', function(err, result) {
    console.log(cassandraMock.requestCount) // 1
    console.log(cassandraMock.connectionCount) // 1

    // do another query...

    cassandra.execute('SOME QUERY', function(err, result) {
        console.log(cassandraMock.requestCount) // 2
        console.log(cassandraMock.connectionCount) // 1
    });
});

support

Donations are welcome to help support the continuous development of this project.

Flattr Bitcoin

About

Basic mocking of cassandra-driver node module.

Resources

License

Stars

Watchers

Forks

Packages

No packages published