1
0
mirror of https://github.com/redis/node-redis.git synced 2025-08-04 15:02:09 +03:00

slight refactor from code review

smoke test large list of commands

ported more tests to mocha, some slight cleanup in tests

move sinon and uuid to dev dependencies

finished porting eval tests over to mocha

rebased mocha testing branch with master

ported client and script tests

ported watch tests

ported detect_buffers tests

ported unref tests

ported auth tests over to mocha

ported idle and no_delay tests

ported hlen, hset

continuing marching forward

ported hincrby, sinter, sort, pubsub tests. improved logic in redis-process, I was still occasionally having issues where redis failed to exit.

switch back to default test command

ported del, exists, hlen, keys, randomkey, type

cleanup based on what I've learned so far from refactor. we now start and stop redis less often. moved tests to their final resting place

finished porting node_redis client tests

ported hgetall, mget, msetnx, rename, renamenx, setex, setnx

ported hgetall, mget, msetnx, rename, renamenx, setex, setnx

ported queue tests to mocha

amalgamated some of the helper logic

ported sadd, scard, sismember, srem, utf-8
This commit is contained in:
Benjamin Coe
2015-07-22 20:59:08 -07:00
parent 04fe11b0f5
commit a0832c3744
54 changed files with 3013 additions and 2593 deletions

View File

@@ -0,0 +1,63 @@
var assert = require("assert");
var config = require("../lib/config");
var helper = require("../helper");
var redis = config.redis;
describe("The 'type' method", function () {
function allTests(parser, ip) {
var args = config.configureClient(parser, ip);
describe("using " + parser + " and " + ip, function () {
var client;
beforeEach(function (done) {
client = redis.createClient.apply(redis.createClient, args);
client.once("error", done);
client.once("connect", function () {
client.flushdb(done);
});
});
it('reports string type', function (done) {
client.set(["string key", "should be a string"], helper.isString("OK"));
client.TYPE(["string key"], helper.isString("string", done));
});
it('reports list type', function (done) {
client.rpush(["list key", "should be a list"], helper.isNumber(1));
client.TYPE(["list key"], helper.isString("list", done));
});
it('reports set type', function (done) {
client.sadd(["set key", "should be a set"], helper.isNumber(1));
client.TYPE(["set key"], helper.isString("set", done));
});
it('reports zset type', function (done) {
client.zadd(["zset key", "10.0", "should be a zset"], helper.isNumber(1));
client.TYPE(["zset key"], helper.isString("zset", done));
});
it('reports hash type', function (done) {
client.hset(["hash key", "hashtest", "should be a hash"], helper.isNumber(1));
client.TYPE(["hash key"], helper.isString("hash", done));
});
it('reports none for null key', function (done) {
client.TYPE("not here yet", helper.isString("none", done));
});
afterEach(function () {
client.end();
});
});
}
['javascript', 'hiredis'].forEach(function (parser) {
allTests(parser, "/tmp/redis.sock");
['IPv4', 'IPv6'].forEach(function (ip) {
allTests(parser, ip);
})
});
});