(proxyHttpImpl, { nodeId = 'node_test' } = {})
| 10 | const { EvoMapProxy, parseRetryAfterMs } = require('../src/proxy/index.js'); |
| 11 | |
| 12 | function makeProxy(proxyHttpImpl, { nodeId = 'node_test' } = {}) { |
| 13 | const p = Object.create(EvoMapProxy.prototype); |
| 14 | p._searchCache = new Map(); |
| 15 | p._searchInflight = new Map(); |
| 16 | p._searchCooldownUntil = 0; |
| 17 | p.store = { getState: (k) => (k === 'node_id' ? nodeId : undefined) }; |
| 18 | p.logger = { warn() {} }; |
| 19 | let calls = 0; |
| 20 | p._proxyHttp = async (...args) => { calls += 1; return proxyHttpImpl(...args); }; |
| 21 | Object.defineProperty(p, '_calls', { get: () => calls }); |
| 22 | return p; |
| 23 | } |
| 24 | |
| 25 | test('injects this node_id into the search query for hub attribution', async () => { |
| 26 | let seenQuery = null; |
no outgoing calls
no test coverage detected