Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Test Case for Synchronizing Multiple Cache with Namespace #36

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions packages/bentocache/tests/bus/bus.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,29 @@ test.group('Bus synchronization', () => {
assert.isUndefined(await cache3.get(key))
}).disableTimeout()

test('synchronize multiple cache with namespace', async ({ assert }) => {
const key = 'foo'

const [cache1] = new CacheFactory().withL1L2Config().create()
const [cache2] = new CacheFactory().withL1L2Config().create()
const [cache3] = new CacheFactory().withL1L2Config().create()

await cache1.namespace('users').set(key, 24)
await setTimeout(100)

assert.equal(await cache1.namespace('users').get(key), 24)
assert.equal(await cache2.namespace('users').get(key), 24)
assert.equal(await cache3.namespace('users').get(key), 24)

await cache1.namespace('users').delete(key)

await setTimeout(100)

assert.isUndefined(await cache1.namespace('users').get(key))
assert.isUndefined(await cache2.namespace('users').get(key))
assert.isUndefined(await cache3.namespace('users').get(key))
}).disableTimeout()

test('retry queue processing', async ({ assert }) => {
const bus1 = new ChaosBus(new MemoryTransport())
const bus2 = new ChaosBus(new MemoryTransport())
Expand Down
Loading