mirror of
https://gitlab.com/soapbox-pub/ditto.git
synced 2025-12-06 11:29:46 +00:00
18 lines
578 B
TypeScript
18 lines
578 B
TypeScript
import { assert } from '@std/assert';
|
|
|
|
import ExpiringCache from './expiring-cache.ts';
|
|
|
|
Deno.test('ExpiringCache', async () => {
|
|
const cache = new ExpiringCache(await caches.open('test'));
|
|
|
|
await cache.putExpiring('http://mostr.local/1', new Response('hello world'), 300);
|
|
await cache.putExpiring('http://mostr.local/2', new Response('hello world'), -1);
|
|
|
|
// const resp1 = await cache.match('http://mostr.local/1');
|
|
const resp2 = await cache.match('http://mostr.local/2');
|
|
|
|
// assert(resp1!.headers.get('Expires'));
|
|
assert(!resp2);
|
|
|
|
// await resp1!.text();
|
|
});
|