Bulk store test
This commit is contained in:
parent
49db47e1fd
commit
d9a5899b27
|
@ -2,9 +2,10 @@ import { generator, structures } from "../../../tests"
|
|||
import RedisWrapper from "../redis"
|
||||
|
||||
describe("redis", () => {
|
||||
const redis = new RedisWrapper(structures.db.id())
|
||||
let redis: RedisWrapper
|
||||
|
||||
beforeAll(async () => {
|
||||
beforeEach(async () => {
|
||||
redis = new RedisWrapper(structures.db.id())
|
||||
await redis.init()
|
||||
})
|
||||
|
||||
|
@ -18,4 +19,23 @@ describe("redis", () => {
|
|||
expect(await redis.get(key)).toEqual(value)
|
||||
})
|
||||
})
|
||||
|
||||
describe("bulkStore", () => {
|
||||
it("a basic object can be persisted", async () => {
|
||||
const data = generator
|
||||
.unique(() => generator.word(), 10)
|
||||
.reduce((acc, key) => {
|
||||
acc[key] = generator.word()
|
||||
return acc
|
||||
}, {} as Record<string, string>)
|
||||
|
||||
await redis.bulkStore(data)
|
||||
|
||||
for (const [key, value] of Object.entries(data)) {
|
||||
expect(await redis.get(key)).toEqual(value)
|
||||
}
|
||||
|
||||
expect(await redis.keys("*")).toHaveLength(10)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue