Open KATT opened 3 years ago
FYI: I [re-]discovered that Lodash merge does not merge arrays.
Here is the thing I can't do within the context of the current behavior
beforeEach
webhookReceiver.requestList.length
was always 0
when I had this in a beforeEach
which was super unintuitive and I thought it was my own code that was broken for half an hour or so. Something in the _.merge()
seem to duplicate the array instead of referencing it, which makes this broken.
I might be wrong though - will do another test.
https://github.com/calendso/calendso/pull/975
Here you can see a clear example of this failing in the first commit and works when I revert it
@KATT you might be interested in the child process provider https://github.com/prisma-labs/konn#standard-providers
Background
In my tests - I often spin up servers as part of
beforeEach
. In the particular area where I encountered problems is that my test server kept track of incoming requests by a mutable array. Couldn't for the life of me understand why the array was constantly empty, but I think this was the culprit.To be even more specific, I was testing a websocket trigger/receiver - so I in my tests I dynamically use
http.createServer()
& later I want to assert that the server received events as after doing specific actions in my app.TODO