Closed
Description
Describe the Bug
CloudEvent
class instances are at the moment not comparable using some popular libraries. Instances might be considered equal although they are not equal.
See the following issues:
- [Bug]: toStrictEquals incorrectly compares class instances with getters that access private fields jestjs/jest#13535
- Inconsistency when comparing simple objects and class instances with getters and private JS fields planttheidea/fast-equals#91
Steps to Reproduce
- Create two CloudEvent instances with different data properties
- Pass the instances to
expect(...).toStrictEqual(...)
of jest and tocircularDeepEqual(...)
of the fast-equals library - Both calls will consider those CloudEvent instances to be equal although they are not equal
Expected Behavior
Both instances should not be considered equal using those libraries.
How to fix
I think the best way to avoid this issue is to avoid using private javascript fields and use private Typescript fields instead.
Metadata
Metadata
Assignees
Labels
No labels