Skip to content

Commit 90e3f23

Browse files
committed
fix: fixed tests with ioredis-mock
1 parent e8a8447 commit 90e3f23

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@
4949
"eslint-config-xo-lass": "^2.0.1",
5050
"fixpack": "^4.0.0",
5151
"husky": "^8.0.1",
52+
"ioredis": "^5.0.6",
53+
"ioredis-mock": "^8.2.2",
5254
"lint-staged": "13.0.0",
5355
"mongoose": "^6.3.5",
5456
"nyc": "^15.1.0",

test/test.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
const Passport = require('@ladjs/passport');
2+
const Redis = require('ioredis-mock');
23
const Router = require('@koa/router');
34
const request = require('supertest');
45
const test = require('ava');
@@ -13,6 +14,7 @@ test('allows custom routes', async (t) => {
1314
});
1415

1516
const api = new API({
17+
redis: new Redis(),
1618
routes: router.routes()
1719
});
1820

@@ -22,7 +24,7 @@ test('allows custom routes', async (t) => {
2224
});
2325

2426
test('with redis instance', (t) => {
25-
const api = new API();
27+
const api = new API({ redis: new Redis() });
2628
t.is(typeof api.client, 'object');
2729
t.is(typeof api.app.context.client, 'object');
2830
});
@@ -35,13 +37,13 @@ test('without redis instance', (t) => {
3537

3638
test('with passport instance', (t) => {
3739
const passport = new Passport({});
38-
const api = new API({ passport });
40+
const api = new API({ passport, redis: new Redis() });
3941
t.is(typeof api.passport, 'object');
4042
t.is(typeof api.app.context.passport, 'object');
4143
});
4244

4345
test('without passport instance', (t) => {
44-
const api = new API();
46+
const api = new API({ redis: new Redis() });
4547
t.is(api.passport, false);
4648
t.is(api.app.context.passport, false);
4749
});

0 commit comments

Comments
 (0)