| 112 | const fetchGate = new Promise((r) => { releaseFetch = r; }); |
| 113 | let fetchCount = 0; |
| 114 | const fetchImpl = async (url) => { |
| 115 | if (url.endsWith('/a2a/validator/stake')) return mkRes({ stake: { stake_amount: 100 } }); |
| 116 | if (url.endsWith('/a2a/fetch')) { |
| 117 | fetchCount += 1; |
| 118 | if (fetchCount === 1) { |
| 119 | // Signal that tick #1 is now awaiting and block until we poke. |
| 120 | inflightResolve(); |
| 121 | await fetchGate; |
| 122 | } |
| 123 | return mkRes({ validation_tasks: [] }); |
| 124 | } |
| 125 | return mkRes({}); |
| 126 | }; |
| 127 | |
| 128 | await withFakeFetch(fetchImpl, async () => { |
| 129 | const v = freshRequire('../src/gep/validator'); |