Skip to content

fix(assert): assertObjectMatch() does not print objects correctly - #5408

Closed
babiabeo wants to merge 24 commits into
denoland:mainfrom
babiabeo:fix-assert-object-match
Closed

babiabeo wants to merge 24 commits into
denoland:mainfrom
babiabeo:fix-assert-object-match

Conversation

@babiabeo

Copy link
Copy Markdown
Contributor

Fixes: #3472

  • Currently, when filtering arrays, assertObjectMatch() uses fn({ ...value }, { ...subset }), which converts arrays into objects. Consequently, arrays are displayed as objects. This PR adds filterArray() to handle arrays.

Fixes: #3771

  • When filtering objects, if actual and expected don't have the same keys or symbols, the fn() currently returns an empty object. It leads to missing properties if both are not empty. This PR adds logic so that it returns the keys and symbols in actual instead of an empty one. (also rename fn() to filterObject())

@babiabeo
babiabeo requested a review from kt3k as a code owner July 11, 2024 05:01
@codecov

codecov Bot commented Jul 11, 2024 •

Copy link
Copy Markdown

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.36%. Comparing base (3af2ed3) to head (62c21a5).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #5408   +/-   ##
=======================================
  Coverage   96.35%   96.36%           
=======================================
  Files         463      463           
  Lines       37729    37789   +60     
  Branches     5568     5585   +17     
=======================================
+ Hits        36355    36415   +60     
  Misses       1332     1332           
  Partials       42       42           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@babiabeo babiabeo changed the title fix(assert): assertObjectMatch() does not print inputs correctly fix(assert): assertObjectMatch() does not print objects correctly Jul 11, 2024
@babiabeo
babiabeo marked this pull request as draft July 12, 2024 03:17
@babiabeo
babiabeo marked this pull request as ready for review July 12, 2024 09:32
@iuioiua
iuioiua self-requested a review July 14, 2024 00:15
@iuioiua

iuioiua commented Jul 18, 2024

Copy link
Copy Markdown
Contributor

Are you able to split this into separate PRs? There are a few moving parts and I don't want to miss anything.

@babiabeo

Copy link
Copy Markdown
Contributor Author

Sure 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

assertObjectMatch doesn't print whole object in assertion error assertObjectMatch error message diff prints arrays as objects

3 participants