Skip to content

Commit 0940623

Browse files
committed
test: fix failing tests
1 parent 4625ce7 commit 0940623

File tree

3 files changed

+21
-31
lines changed

3 files changed

+21
-31
lines changed

packages/prometheus/package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,11 @@
2929
"checks": "pnpm lint && pnpm typecheck"
3030
},
3131
"peerDependencies": {
32-
"bentocache": "1.0.0-beta.7",
32+
"bentocache": "^1.0.0",
3333
"prom-client": "^15.0.0"
3434
},
3535
"devDependencies": {
36+
"@julr/utils": "^1.4.0",
3637
"bentocache": "workspace:*",
3738
"prom-client": "^15.1.3"
3839
},

packages/prometheus/tests/prometheus_plugin.spec.ts

+16-16
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,10 @@ test.group('Prometheus Plugin', () => {
3333
test('register hit/miss/write/deletes events', async ({ assert }) => {
3434
const { bento, registry } = createCache()
3535

36-
await bento.get('foo')
37-
await bento.set('foo', 'bar')
38-
await bento.get('foo')
39-
await bento.delete('foo')
36+
await bento.get({ key: 'foo' })
37+
await bento.set({ key: 'foo', value: 'bar' })
38+
await bento.get({ key: 'foo' })
39+
await bento.delete({ key: 'foo' })
4040

4141
const hits = await registry.getSingleMetric('bentocache_hits')?.get()
4242
const misses = await registry.getSingleMetric('bentocache_misses')?.get()
@@ -52,17 +52,17 @@ test.group('Prometheus Plugin', () => {
5252
test('register graced hits', async ({ assert }) => {
5353
const { bento, registry } = createCache()
5454

55-
await bento.set('foo', 'bar', { ttl: 1, grace: '2' })
55+
await bento.set({ key: 'foo', value: 'bar', ttl: 1, grace: '2h' })
5656

5757
await sleep(400)
5858

59-
await bento.getOrSet(
60-
'foo',
61-
() => {
59+
await bento.getOrSet({
60+
key: 'foo',
61+
factory: () => {
6262
throw new Error('Factory error')
6363
},
64-
{ grace: '2h' },
65-
)
64+
grace: '2h',
65+
})
6666

6767
const hits = await registry.getSingleMetric('bentocache_hits')?.get()
6868
const gracedHits = await registry.getSingleMetric('bentocache_graced_hits')?.get()
@@ -84,13 +84,13 @@ test.group('Prometheus Plugin', () => {
8484
],
8585
})
8686

87-
await bento.set('posts:1', 'foo')
88-
await bento.set('posts:2', 'bar')
87+
await bento.set({ key: 'posts:1', value: 'foo' })
88+
await bento.set({ key: 'posts:2', value: 'bar' })
8989

90-
await bento.get('users:1')
91-
await bento.get('users:2')
92-
await bento.get('posts:1')
93-
await bento.get('posts:2')
90+
await bento.get({ key: 'users:1' })
91+
await bento.get({ key: 'users:2' })
92+
await bento.get({ key: 'posts:1' })
93+
await bento.get({ key: 'posts:2' })
9494

9595
const hits = await registry.getSingleMetric('bentocache_hits')?.get()
9696
const misses = await registry.getSingleMetric('bentocache_misses')?.get()

pnpm-lock.yaml

+3-14
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)