Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Address deepEqual using compare by JSON strings. #724

Merged
merged 2 commits into from Oct 23, 2019

Conversation

jseter
Copy link
Contributor

@jseter jseter commented Oct 21, 2019

  1. JSON does not guarantee the ordering that fields are encoded in the string, making it unreliable for generic hashing.
  2. When ordering is maintained, the strings match the ordering the fields were added to the object, making the unit test too tighly coupled to the order they are added in the implementation.
  3. A field whose value is undefined versus not being present presents a difference that deepEqual should assert. If it does not matter then possibly a different assert should be used.

Jamie Seter added 2 commits October 21, 2019 11:18
1) JSON does not guarantee the ordering that fields are encoded in the string, making it unreliable for generic hashing.
2) When ordering is maintained, the strings match the ordering the fields were added to the object, making the unit test too tighly coupled to the order they are added in the implementation.
3) A field whose value is undefined versus not being present presents a difference that deepEqual should assert.  If it does not matter then possibly a different assert should be used.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants