Skip to content

fix(assert): assertObjectMatch doesn't print whole object - #5498

Merged
iuioiua merged 3 commits into
denoland:mainfrom
babiabeo:fix-assertObjectMatch-1
Jul 21, 2024
Merged

iuioiua merged 3 commits into
denoland:mainfrom
babiabeo:fix-assertObjectMatch-1

Conversation

@babiabeo

Copy link
Copy Markdown
Contributor

Separated from #5408
Fix: #3771

When filtering two objects, the fn() function returns an empty object if they don't have the same keys or symbols. This PR adds the logic so that it returns the entries of the first object in this case. (also rename fn to filterObject)

@babiabeo
babiabeo requested a review from kt3k as a code owner July 20, 2024 06:58
@codecov

codecov Bot commented Jul 20, 2024 •

Copy link
Copy Markdown

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.30%. Comparing base (c3ccd67) to head (53636e8).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #5498   +/-   ##
=======================================
  Coverage   96.30%   96.30%           
=======================================
  Files         463      463           
  Lines       37660    37669    +9     
  Branches     5558     5561    +3     
=======================================
+ Hits        36267    36276    +9     
  Misses       1351     1351           
  Partials       42       42           

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

@iuioiua iuioiua left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

Comment thread assert/object_match.ts

// When both operands are set, build a filtered set with common values
if ((value instanceof Set) && (subset instanceof Set)) {
filtered[key] = value.intersection(subset);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice

@iuioiua
iuioiua merged commit ab8f6a5 into denoland:main Jul 21, 2024
@babiabeo
babiabeo deleted the fix-assertObjectMatch-1 branch July 21, 2024 23:56
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

2 participants