You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, this test line does not make sense, really what you are doing, is to test the behavior of microjs against a stream of data, not microrouter, the correct test would be like this:
test('route which sends a Stream',async(t)=>{constreadable=newReadable()const{ methods, handler }=createRouter()const{ post }=methodsreadable._read=()=>{}readable.push('foo')readable.push(null)post('/stream',(req,res)=>{letdata=''req.on('data',(chunk)=>data+=chunk)req.on('end',()=>send(res,200,data))})consturl=awaitserver(handler)// using node-fetch support ArrayBuffer | ArrayBufferView | NodeJS.ReadableStream, etcconstresponse=awaitfetch(`${url}/stream`,{method: 'POST',body: readable})t.is(awaitresponse.text(),'foo')})`
I realized this because I'm making my own routing system, based on yours.
Regards.
The text was updated successfully, but these errors were encountered:
Hi, this test line does not make sense, really what you are doing, is to test the behavior of microjs against a stream of data, not microrouter, the correct test would be like this:
I realized this because I'm making my own routing system, based on yours.
Regards.
The text was updated successfully, but these errors were encountered: