Skip to content

[Chakra v3] Clean up and enable tests for hooks folders#2783

Merged
alexvuong merged 22 commits intofeature/chakra-ui-upgrade-v3from
cleanup/chakra-ui-v3-part-1
Jul 14, 2025
Merged

[Chakra v3] Clean up and enable tests for hooks folders#2783
alexvuong merged 22 commits intofeature/chakra-ui-upgrade-v3from
cleanup/chakra-ui-v3-part-1

Conversation

@alexvuong
Copy link
Contributor

@alexvuong alexvuong commented Jul 10, 2025

Description

This PR cleaned up lint message and enable tests for hooks.

Note: there are some tests about Passwordless login feature that has bug and are being fixed from develop. Will port over when the PR #2758 is merged

Types of Changes

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Documentation update
  • Breaking change (could cause existing functionality to not work as expected)
  • Other changes (non-breaking changes that does not fit any of the above)

Breaking changes include:

  • Removing a public function or component or prop
  • Adding a required argument to a function
  • Changing the data type of a function parameter or return value
  • Adding a new peer dependency to package.json

Changes

  • (change1)

How to Test-Drive This PR

  • (step1)

Checklists

General

  • Changes are covered by test cases
  • CHANGELOG.md updated with a short description of changes (not required for documentation updates)

Accessibility Compliance

You must check off all items in one of the follow two lists:

  • There are no changes to UI

or...

Localization

  • Changes include a UI text update in the Retail React App (which requires translation)

@cc-prodsec
Copy link
Collaborator

cc-prodsec commented Jul 10, 2025

🎉 Snyk checks have passed. No issues have been found so far.

security/snyk check is complete. No issues have been found. (View Details)

license/snyk check is complete. No issues have been found. (View Details)

@alexvuong alexvuong changed the title Cleanup/chakra UI v3 part 1 [Chakra v3] Clean up and enable tests for hooks folders Jul 10, 2025
@alexvuong alexvuong marked this pull request as ready for review July 10, 2025 23:45
@alexvuong alexvuong requested a review from a team as a code owner July 10, 2025 23:45
'<rootDir>/src/pages/checkout/partials/contact-info.test.js',
createTestGlob('hooks/'),
createTestGlob('pages/registration'),
// '<rootDir>/src/pages/checkout/partials/contact-info.test.js',
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will enable this back when passwordless bug is fixed in #2783 is merged. I will port the changes to here and fix tests

as="ul"
data-testid="account-detail-nav"
>
{navLinks.map((link, index) => {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

unused

borderRadius={{base: 'none', md: 'base'}}
bgColor="gray.50"
data-testid="add-to-cart-modal"
aria-labelledby={dialogTitleId}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

adding a11y so test can find this element in DOM

},
{quantity: numberOfItemsAdded}
)}
<Heading as="h1" fontSize="2xl" id={dialogTitleId}>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

adding id to connect to aria-labelledby

import React from 'react'
import {screen, waitFor} from '@testing-library/react'
import {rest} from 'msw'
import {act, screen, waitFor} from '@testing-library/react'
Copy link
Contributor

Choose a reason for hiding this comment

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

I assume act has been added only for the tests that has warning of falky?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes I wrapped them all with act. So far I've noticed no flakiness, which is a good sign.

…-part-1

# Conflicts:
#	packages/extension-chakra-storefront/jest.config.js
})
test('Allows customer to sign in to their account', async () => {

//TODO: fix broken test
Copy link
Contributor

Choose a reason for hiding this comment

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

Are we skipping the test until we merge PR #2758 passwordless login state management issue? Can we add that to the TODO so we remember?

Copy link
Contributor Author

@alexvuong alexvuong Jul 14, 2025

Choose a reason for hiding this comment

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

ah this test is not related to that. For some reason, this test keep failing here, I find it may take too much time to fix, so I will leave this one skipped til we get to the ticket where we address failing tests

@alexvuong alexvuong merged commit 47d4bbd into feature/chakra-ui-upgrade-v3 Jul 14, 2025
33 checks passed
alexvuong added a commit that referenced this pull request Jul 16, 2025
Clean up warning in the terminal when running tests and re-enable tests in hook folders
@alexvuong alexvuong deleted the cleanup/chakra-ui-v3-part-1 branch July 16, 2025 22:13
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.

4 participants