()
| 73 | |
| 74 | /** Stands in for the Workers Cache API: shared across "isolates", in memory. */ |
| 75 | const makeStoreHarness = (): StoreHarness => { |
| 76 | const entries = new Map<string, StoredJwks>(); |
| 77 | let reads = 0; |
| 78 | let writes = 0; |
| 79 | return { |
| 80 | get: async (url) => { |
| 81 | reads++; |
| 82 | return entries.get(url.toString()) ?? null; |
| 83 | }, |
| 84 | put: async (url, stored) => { |
| 85 | writes++; |
| 86 | entries.set(url.toString(), stored); |
| 87 | }, |
| 88 | seed: (stored) => { |
| 89 | entries.set(jwksUrl.toString(), stored); |
| 90 | }, |
| 91 | reads: () => reads, |
| 92 | writes: () => writes, |
| 93 | }; |
| 94 | }; |
| 95 | |
| 96 | /** A fetch that always fails, standing in for a slow/down key server. */ |
| 97 | const failingFetch: typeof globalThis.fetch = async () => { |
no test coverage detected