1
0
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:
Ruben Bridgewater
2017-05-30 06:45:28 +02:00
parent 31fafd8b7c
commit b6c317dbb0
8 changed files with 82 additions and 12 deletions

View File

@@ -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