Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor Link to add more cheap unit tests #4553

Merged
merged 8 commits into from
Oct 25, 2024

Conversation

OleksandrNechai
Copy link
Collaborator

@OleksandrNechai OleksandrNechai commented Sep 12, 2024

[FX-NNNN]

Description

This if a follow up of f8e5c8f and #4547. Where I did not test code due to inability to add cheap test.

Extract all view logic into separate pure function. This allows adding many tests that run in few ms, raising confidence in our code without making tests suits running forever.

How to test

Locally yarn test:unit:watch

Development checks

  • Add changeset according to guidelines (if needed)
  • Double check if picasso-tailwind-merge requires major update (check its README.md)
  • Read CONTRIBUTING.md and Component API principles
  • Make sure that additions and changes on the design follow Toptal's BASE design, and it's been already discussed with designers at #-base-core
  • Annotate all props in component with documentation
  • Create examples for component
  • Ensure that deployed demo has expected results and good examples
  • Ensure the changed/created components have not caused accessibility issues. How to use accessibility plugin in storybook.
  • Self reviewed
  • Covered with tests (visual tests included)

Breaking change

  • codemod is created and showcased in the changeset
  • test alpha package of Picasso in StaffPortal

All development checks should be done and set checked to pass the
GitHub Bot: TODOLess action

PR commands

List of available commands:

  • @toptal-bot run package:alpha-release - Release alpha version
  • @toptal-anvil ping reviewers - Ping FX team for review
PR Review Guidelines

When to approve? ✅

You are OK with merging this PR and

  1. You have no extra requests.
  2. You have optional requests.
    1. Add nit: to your comment. (ex. nit: I'd rename this variable from makeCircle to getCircle)

When to request changes? ❌

You are not OK with merging this PR because

  1. Something is broken after the changes.
  2. Acceptance criteria is not reached.
  3. Code is dirty.

When to comment (neither ✅ nor ❌)

You want your comments to be addressed before merging this PR in cases like:

  1. There are leftovers like unnecessary logs, comments, etc.
  2. You have an opinionated comment regarding the code that requires a discussion.
  3. You have questions.

How to handle the comments?

  1. An owner of a comment is the only one who can resolve it.
  2. An owner of a comment must resolve it when it's addressed.
  3. A PR owner must reply with ✅ when a comment is addressed.

@OleksandrNechai OleksandrNechai requested a review from a team September 12, 2024 15:18
Copy link

changeset-bot bot commented Sep 12, 2024

⚠️ No Changeset found

Latest commit: 55a9e28

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@OleksandrNechai OleksandrNechai self-assigned this Sep 12, 2024
@sashuk sashuk requested a review from a team September 12, 2024 15:59
@ruslan-sed ruslan-sed self-requested a review September 16, 2024 10:10
Copy link
Contributor

@ruslan-sed ruslan-sed left a comment

Choose a reason for hiding this comment

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

Great job!
Very nice way to simplify component testing by extracting logic to helper function 👍

packages/base/Link/src/Link/test.tsx Show resolved Hide resolved
Copy link
Contributor

@sashuk sashuk left a comment

Choose a reason for hiding this comment

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

Looks good!

@OleksandrNechai OleksandrNechai force-pushed the fx-refactor-link-away-from-being-too-complex branch 2 times, most recently from a224ead to b32a83c Compare September 18, 2024 08:53
@ruslan-sed
Copy link
Contributor

@OleksandrNechai don't you want to merge it?

@OleksandrNechai OleksandrNechai force-pushed the fx-refactor-link-away-from-being-too-complex branch from b32a83c to d9216c1 Compare October 25, 2024 14:40
@OleksandrNechai OleksandrNechai merged commit a3e5437 into master Oct 25, 2024
18 of 22 checks passed
@OleksandrNechai OleksandrNechai deleted the fx-refactor-link-away-from-being-too-complex branch October 25, 2024 16:27
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.

3 participants