Closed tpoisseau closed 5 months ago
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 92.54%. Comparing base (
7d4d94b
) to head (d8ae4ab
).
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
It's tested but I'm not a big fan to rely on mongodb internals. If you found a better approach to known if transactions is aborted from public API I'm interested.
For testing I created a small helper promiseController
to be able to resolve or reject outside the promise executor.
I know it's quite unusual, I'm open to suggestion to avoid this pattern but keeping comprehensible testing code flow.
Or use a similar built-in helper if exists.
For testing I created a small helper promiseController to be able to resolve or reject outside the promise executor.
Maybe name it promiseWithResolvers
or use a ponyfill of the standard API?
If you found a better approach to known if transactions is aborted from public API I'm interested.
I remember already looking into it in the past and didn't find a public API
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/withResolvers#browser_compatibility It's great we have this in ES api, It seems it supported since Node.js v22 so I'll not use it in this project. I'll rename so it match existing api and put a todo.
'commit'
event if transaction committed and is not aborted'abort'
event if error happen during transaction'abort'
event ifsession.abortTransaction()
Refs: https://github.com/zakodium/profid/issues/1699