seanmturley / natureddit

A simple Reddit client, featuring a landing page dedicated to nature with posts pulled from a curated list of subreddits.
0 stars 1 forks source link

Add Card tests #143

Closed seanmturley closed 8 months ago

seanmturley commented 9 months ago

Description

Add tests for the Card component.

A guide to testing React Router related functions is available in the official Testing Library documentation.

Tests:

On subreddit pages Card should display:

On the homepage and search pages Card should display:

seanmturley commented 8 months ago

Spent a bit of time working on formatNumber improvements, including correct plural vs singular for "comments"/"upvotes ", but I think these words will be replaced with icons anyway, so it's unnecessary.

I'm removing these from the task list above (though correct pluralisation still applies to the units of time for post age).

seanmturley commented 8 months ago

Added tests for post age - possibly a bit over-exhaustive, though I only checked rounding and removal of plural "s" for one unit of time.

seanmturley commented 8 months ago

Added simple test to check the post's image loads in Card.

That's the Card tests done. Closing.