Skip to content

Commit

Permalink
Test ioredis 5 (#375)
Browse files Browse the repository at this point in the history
  • Loading branch information
janhalama authored Feb 2, 2023
1 parent df96b20 commit e5c6cd1
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
"eslint": "^7.4.0",
"eslint-config-prettier": "^8.3.0",
"express-session": "^1.17.0",
"ioredis": "^4.17.1",
"ioredis-v4": "npm:ioredis@4",
"ioredis-v5": "npm:ioredis@5",
"nyc": "^15.0.1",
"prettier": "^2.0.5",
"redis-mock": "^0.56.3",
Expand Down
2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ redisClient.connect().catch(console.error)
const { createClient } = require("redis")
let redisClient = createClient()

// ioredis
// ioredis@v4 and ioredis@v5
const Redis = require("ioredis")
let redisClient = new Redis()

Expand Down
14 changes: 11 additions & 3 deletions test/connect-redis-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ const redisSrv = require("../test/redis-server")
const session = require("express-session")
const redisV3 = require("redis-v3")
const redisV4 = require("redis-v4")
const ioRedis = require("ioredis")
const ioRedisV4 = require("ioredis-v4")
const ioRedisV5 = require("ioredis-v5")
const redisMock = require("redis-mock")

let RedisStore = require("../")(session)
Expand Down Expand Up @@ -54,8 +55,15 @@ test("node_redis v4", async (t) => {
await client.disconnect()
})

test("ioredis", async (t) => {
var client = ioRedis.createClient(redisSrv.port, "localhost")
test("ioredis 4", async (t) => {
var client = ioRedisV4.createClient(redisSrv.port, "localhost")
var store = new RedisStore({ client })
await lifecycleTest(store, t)
client.disconnect()
})

test("ioredis 5", async (t) => {
var client = ioRedisV5.createClient(redisSrv.port, "localhost")
var store = new RedisStore({ client })
await lifecycleTest(store, t)
client.disconnect()
Expand Down

0 comments on commit e5c6cd1

Please sign in to comment.