v1.18.x
Baris Usakli 7 years ago
parent d0c9c52f9b
commit dbf815ed47

@ -102,7 +102,7 @@ module.exports = function (redisClient, module) {
module.deleteObjectField = function (key, field, callback) { module.deleteObjectField = function (key, field, callback) {
callback = callback || function () {}; callback = callback || function () {};
if (field === null) { if (key === undefined || key === null || field === undefined || field === null) {
return setImmediate(callback); return setImmediate(callback);
} }
redisClient.hdel(key, field, function (err) { redisClient.hdel(key, field, function (err) {

@ -330,6 +330,34 @@ describe('Hash methods', function () {
}); });
}); });
}); });
it('should not error if key is undefined', function (done) {
db.deleteObjectField(undefined, 'someField', function (err) {
assert.ifError(err);
done();
});
});
it('should not error if key is null', function (done) {
db.deleteObjectField(null, 'someField', function (err) {
assert.ifError(err);
done();
});
});
it('should not error if field is undefined', function (done) {
db.deleteObjectField('someKey', undefined, function (err) {
assert.ifError(err);
done();
});
});
it('should not error if field is null', function (done) {
db.deleteObjectField('someKey', null, function (err) {
assert.ifError(err);
done();
});
});
}); });
describe('incrObjectField()', function () { describe('incrObjectField()', function () {

Loading…
Cancel
Save