DEV Community

Discussion on: I Went to Write Two Tests and Ended Up Fixing the App

Collapse
 
wamzii profile image
cynthia wahome •

Good questions. Here's what I found.

Fixtures. My PRs have both kinds. #686 added a unit test with a post that has no reportedBy key at all, kept on purpose as the regression for this bug, and #698's E2E specs create their posts through the real addPost mutation. The older component unit tests still use a hand-typed fixture with reportedBy: [], so your point holds there, and that's how the bug stayed hidden.

Your count. New posts now get reportedBy: [], but approvedBy, rejectedBy and bookmarkedBy are missing on all 50 of my local posts. I approved, rejected and saved a post with those lists missing, and all three worked, so the ?? [] reads hold up.

The double toast. You called it: the component's catch and the global error link both show it, and switching either off leaves exactly one toast. I raised it with the maintainers so they can decide which should own it.

Count of posts missing each list: reportedBy is covered, the other three are missing on all 50

Terminal output: 50 posts in total, 0 missing reportedBy, and 50 each missing approvedBy, rejectedBy and bookmarkedBy

The double toast: the same error shown twice (Reject 1 and Saved confirm those clicks worked)

Two identical red toasts reading "You have already reported this post"; the post shows Reject 1 and Saved