You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-06 02:15:48 +03:00
chore: improve coverage
This commit is contained in:
@@ -57,6 +57,26 @@ describe('The nodeRedis client', () => {
|
||||
client._stream.destroy()
|
||||
})
|
||||
|
||||
describe('arguments validation', () => {
|
||||
it('no boolean for enableOfflineQueue', () => {
|
||||
try {
|
||||
redis.createClient({ enableOfflineQueue: 'test' })
|
||||
throw new Error('failed')
|
||||
} catch (err) {
|
||||
assert.strictEqual(err.name, 'TypeError')
|
||||
}
|
||||
})
|
||||
|
||||
it('no boolean for enableOfflineQueue', () => {
|
||||
try {
|
||||
redis.createClient({ password: 'test', authPass: 'foobar' })
|
||||
throw new Error('failed')
|
||||
} catch (err) {
|
||||
assert.strictEqual(err.name, 'TypeError')
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
helper.allTests((ip, args) => {
|
||||
describe(`using ${ip}`, () => {
|
||||
afterEach(() => {
|
||||
@@ -69,6 +89,22 @@ describe('The nodeRedis client', () => {
|
||||
return client.flushdb()
|
||||
})
|
||||
|
||||
describe('argument errors', () => {
|
||||
it('should return an error in case of "null" argument', () => {
|
||||
return client.set('foo', null).then(helper.fail, (err) => {
|
||||
assert.deepStrictEqual(err.issues, [null])
|
||||
})
|
||||
})
|
||||
|
||||
it('should return an error in case of unknown types', () => {
|
||||
class Foo {}
|
||||
const tmp = new Foo()
|
||||
return client.set(tmp, undefined).then(helper.fail, (err) => {
|
||||
assert.deepStrictEqual(err.issues, [tmp, undefined])
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
describe('duplicate', () => {
|
||||
it('check if all options got copied properly', (done) => {
|
||||
client.selectedDb = 2
|
||||
|
Reference in New Issue
Block a user