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

test fixup

This commit is contained in:
Ruben Bridgewater
2017-05-06 08:16:19 +02:00
parent f1a7bcd735
commit b2613b2270
106 changed files with 2900 additions and 2967 deletions

View File

@@ -1,34 +1,34 @@
'use strict'
var assert = require('assert')
var config = require('./lib/config')
var helper = require('./helper')
var redis = config.redis
const assert = require('assert')
const config = require('./lib/config')
const helper = require('./helper')
const redis = config.redis
describe('prefix key names', function () {
helper.allTests(function (ip, args) {
describe('using ' + ip, function () {
var client = null
describe('prefix key names', () => {
helper.allTests((ip, args) => {
describe(`using ${ip}`, () => {
let client = null
beforeEach(function (done) {
beforeEach((done) => {
client = redis.createClient({
prefix: 'test:prefix:'
})
client.on('ready', function () {
client.flushdb(function (err) {
client.on('ready', () => {
client.flushdb((err) => {
done(err)
})
})
})
afterEach(function () {
afterEach(() => {
client.end(true)
})
it('auto prefix set / get', function (done) {
it('auto prefix set / get', (done) => {
client.set('key', 'value', helper.isString('OK'))
client.get('key', helper.isString('value'))
client.getrange('key', 1, -1, function (err, reply) {
client.getrange('key', 1, -1, (err, reply) => {
assert.strictEqual(reply, 'alue')
assert.strictEqual(err, null)
})
@@ -36,7 +36,7 @@ describe('prefix key names', function () {
// The key will be prefixed itself
client.exists('test:prefix:key', helper.isNumber(0))
client.mset('key2', 'value2', 'key3', 'value3')
client.keys('*', function (err, res) {
client.keys('*', (err, res) => {
assert.strictEqual(err, null)
assert.strictEqual(res.length, 3)
assert(res.indexOf('test:prefix:key') !== -1)
@@ -46,11 +46,11 @@ describe('prefix key names', function () {
})
})
it('auto prefix set / get with .batch', function (done) {
var batch = client.batch()
it('auto prefix set / get with .batch', (done) => {
const batch = client.batch()
batch.set('key', 'value', helper.isString('OK'))
batch.get('key', helper.isString('value'))
batch.getrange('key', 1, -1, function (err, reply) {
batch.getrange('key', 1, -1, (err, reply) => {
assert.strictEqual(reply, 'alue')
assert.strictEqual(err, null)
})
@@ -58,7 +58,7 @@ describe('prefix key names', function () {
// The key will be prefixed itself
batch.exists('test:prefix:key', helper.isNumber(0))
batch.mset('key2', 'value2', 'key3', 'value3')
batch.keys('*', function (err, res) {
batch.keys('*', (err, res) => {
assert.strictEqual(err, null)
assert.strictEqual(res.length, 3)
assert(res.indexOf('test:prefix:key') !== -1)
@@ -68,11 +68,11 @@ describe('prefix key names', function () {
batch.exec(done)
})
it('auto prefix set / get with .multi', function (done) {
var multi = client.multi()
it('auto prefix set / get with .multi', (done) => {
const multi = client.multi()
multi.set('key', 'value', helper.isString('OK'))
multi.get('key', helper.isString('value'))
multi.getrange('key', 1, -1, function (err, reply) {
multi.getrange('key', 1, -1, (err, reply) => {
assert.strictEqual(reply, 'alue')
assert.strictEqual(err, null)
})
@@ -80,7 +80,7 @@ describe('prefix key names', function () {
// The key will be prefixed itself
multi.exists('test:prefix:key', helper.isNumber(0))
multi.mset('key2', 'value2', 'key3', 'value3')
multi.keys('*', function (err, res) {
multi.keys('*', (err, res) => {
assert.strictEqual(err, null)
assert.strictEqual(res.length, 3)
assert(res.indexOf('test:prefix:key') !== -1)