/
integ-test.mjs
71 lines (55 loc) · 1.57 KB
/
integ-test.mjs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
import validate_backend from '@phorbas/store/esm/node/validate_backend.mjs'
import {bkc_with_ioredis_pipeline, bkc_with_ioredis_direct} from '@phorbas/store/esm/node/ioredis.mjs'
import bkc_with_keyv from '@phorbas/store/esm/node/keyv.mjs'
const IORedis = require('ioredis')
const Keyv = require('keyv')
const KeyvRedis = require('@keyv/redis')
for (const host of ['redis_v5', 'redis_v6']) {
validate_backend(
`${host} with ioredis_pipeline`,
{
create:
ctx => bkc_with_ioredis_pipeline(
ctx.ioredis = new IORedis({host}) ),
done:
ctx => ctx.ioredis.disconnect()
})
validate_backend(
`${host} with ioredis_direct`,
{
create:
ctx => bkc_with_ioredis_direct(
ctx.ioredis = new IORedis({host}) ),
done:
ctx => ctx.ioredis.disconnect()
})
validate_backend(
`${host} with path and ioredis_pipeline`,
{
create:
ctx => bkc_with_ioredis_pipeline(
ctx.ioredis = new IORedis({host}),
{path: '/a/b/c'}),
done:
ctx => ctx.ioredis.disconnect()
})
validate_backend(
`${host} with path and ioredis_direct`,
{
create:
ctx => bkc_with_ioredis_direct(
ctx.ioredis = new IORedis({host}),
{path: '/a/b/c'}),
done:
ctx => ctx.ioredis.disconnect()
})
validate_backend(
`${host} with @keyv/redis`,
{
create:
ctx => bkc_with_keyv(
ctx.inst = new Keyv(`redis://${host}:6379`)),
done:
ctx => ctx.inst.opts.store.redis.disconnect()
})
}