glynnbird commented on issue #379:
URL: https://github.com/apache/couchdb-nano/issues/379#issuecomment-6474541639

   mmm my investigations show that the problem lies when using Undici@7 (as 
bundled in Node 26) with a Undici@8 in the tests. In this circumstance, the 
interceptor's `body` matching fails e.g.
   
   ```js
   test('should be able to send replication request with local database names - 
POST /_replicate - nano.db.replicate', async () => {
     // mocks
     mockPool.intercept({
       method: 'post',
       path: '/_replicate'
       //body: JSON.stringify({ source: COUCH_URL + '/source', target: 
COUCH_URL + '/target' })
     }).reply(200, response, JSON_HEADERS)
   
     // test POST /_replicate
     const p = await nano.db.replicate('source', 'target')
     assert.deepEqual(p, response)
     mockAgent.assertNoPendingInterceptors()
   })
   ```
   
   - if I comment out body matching, the test works
   - if I uncomment it the test fails with `Error: error happened in your 
connection. Reason: MockNotMatchedError: Mock dispatch not matched for body 
'[object AsyncGenerator]' on path '/_replicate': subsequent request to origin 
http://127.0.0.1:5984 was not allowed (net.connect disabled), 1 interceptor(s) 
remaining out of 1 defined`. 
   
   I don't really want to comment out all the body values because then I'm not 
testing whether Nano is sending the correct data!
   
   So perhaps we park migration to Undici@8 for the moment :) 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to