You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-04 15:02:09 +03:00
Increase the coverage by adding tests and fix a failing ready check
This commit is contained in:
@@ -70,6 +70,7 @@ describe("The 'set' method", function () {
|
||||
it("reports an error", function (done) {
|
||||
client.set(undefined, function (err, res) {
|
||||
helper.isError()(err, null);
|
||||
assert.equal(err.command, 'SET');
|
||||
done();
|
||||
});
|
||||
});
|
||||
@@ -90,29 +91,36 @@ describe("The 'set' method", function () {
|
||||
});
|
||||
|
||||
describe("with undefined 'key' and missing 'value' parameter", function () {
|
||||
it("does not emit an error", function (done) {
|
||||
this.timeout(200);
|
||||
|
||||
client.once("error", function (err) {
|
||||
done(err);
|
||||
});
|
||||
|
||||
client.set();
|
||||
|
||||
setTimeout(function () {
|
||||
done();
|
||||
}, 100);
|
||||
});
|
||||
|
||||
it("does emit an error", function (done) {
|
||||
it("emits an error without callback", function (done) {
|
||||
client.on('error', function (err) {
|
||||
assert.equal(err.message, "ERR wrong number of arguments for 'set' command");
|
||||
assert.equal(err.message, 'send_command: SET value must not be undefined or null');
|
||||
assert.equal(err.command, 'SET');
|
||||
done();
|
||||
});
|
||||
|
||||
client.set('foo');
|
||||
client.set(undefined);
|
||||
});
|
||||
});
|
||||
|
||||
it("emit an error with only the key set", function (done) {
|
||||
client.on('error', function (err) {
|
||||
assert.equal(err.message, "ERR wrong number of arguments for 'set' command");
|
||||
done();
|
||||
});
|
||||
|
||||
client.set('foo');
|
||||
});
|
||||
|
||||
it("emit an error without any parameters", function (done) {
|
||||
client.once("error", function (err) {
|
||||
assert.equal(err.message, 'send_command: SET value must not be undefined or null');
|
||||
assert.equal(err.command, 'SET');
|
||||
done();
|
||||
});
|
||||
|
||||
// This was not supported not to throw earlier and was added by the test refactoring
|
||||
// https://github.com/NodeRedis/node_redis/commit/eaca486ab1aecd1329f7452ad2f2255b1263606f
|
||||
client.set();
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
Reference in New Issue
Block a user