Skip to content

Conversation

@Yassahr
Copy link
Contributor

@Yassahr Yassahr commented Oct 3, 2025

Description

Create unit test for gift suggestion card

Before:

Previously, component had no unit test

After:

Describe new behavior, including what was changed and why

Closes #189

Testing instructions

If applicable, provide steps for reviewers to test changes locally -- including necessary setup, commands, and expected results

Additional information

Share any additional info that may provide context for the PR evaluation (performance considerations, design choices, etc)

[optional] Screenshots

Pre-submission checklist

  • Code builds and passes locally
  • PR title follows Conventional Commit format (e.g. test #001: created unit test for __ component)
  • Request reviews from the Peer Code Reviewers and Senior+ Code Reviewers groups
  • Thread has been created in Discord and PR is linked in gis-code-questions

@vercel
Copy link

vercel bot commented Oct 3, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
elecretanta Ready Ready Preview Comment Nov 4, 2025 6:11pm
elecretanta-storybook Ready Ready Preview Comment Nov 4, 2025 6:11pm
elecretanta-unit-test Error Error Nov 4, 2025 6:11pm

* @param {string} giftSuggestionParams.budget - the exchange budget for gift.
* @param {IGiftSuggestion} giftSuggestionParams.gift - the gift suggestion.
* @param {number} giftSuggestionParams.index - the index of the gift.
* @param {IGiftSuggestion | number} giftSuggestionParams.onGiftUpdate - the updated value of index and gift suggestion.
Copy link
Contributor

Choose a reason for hiding this comment

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

The type here: {IGiftSuggestion | number} doesn't seem right for a handler function.

Copy link
Contributor Author

@Yassahr Yassahr Oct 3, 2025

Choose a reason for hiding this comment

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

I was not sure what to put for that function so placed the types of its params.
When I looked at the documentation the params that seemed to align the most would Callback Function https://jsdoc.app/tags-param (bottom of page). Do you agree or do you think something else would be more fitting?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, was looking at the same docs earlier and thought the same about cb being the most similar example in the docs. But looking at other examples from around the interwebs I'm seeing a lot more of this:

* @param {function} props.onGiftUpdate - A function that does x,y,z

or maybe

* @param {function(IGiftSuggestion, number): void} props.onGiftUpdate - ...

I don't see any examples elsewhere in our codebase, so I'll be interested to see what Seniors have to say on this one...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was hesitant to put function as the type because I had never seen that be used but I can guinea pig it

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.

Create unit test for GiftSuggestionCard.tsx

2 participants