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(web-react): Use @local/tests path alias in tests #1807

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

literat
Copy link
Collaborator

@literat literat commented Dec 10, 2024

Description

  1. Introducing barrel files for tests directory
  2. Introducing configuration for @local/tests path alias - tsconfig + ESlint
  3. Use path alias in all tests
  4. Refactoring useIcon mock because of path changes and crazy Jest and JavaScript mock hoisting
  5. Fixing @pavelklibani 's typo in data-testId -> data-testid

Additional context

I suggest doing a review per commit. The settings themselves are in different commits than changes in test files.

Issue reference

https://jira.almacareer.tech/browse/DS-1611
https://jira.almacareer.tech/browse/DS-1612

@github-actions github-actions bot added the refactoring A code change that neither fixes a bug nor adds a feature label Dec 10, 2024
Copy link

netlify bot commented Dec 10, 2024

Deploy Preview for spirit-design-system ready!

Name Link
🔨 Latest commit 0ff16c0
🔍 Latest deploy log https://app.netlify.com/sites/spirit-design-system/deploys/6761ad704df2e800080d4816
😎 Deploy Preview https://deploy-preview-1807--spirit-design-system.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 96 (no change from production)
Accessibility: 91 (no change from production)
Best Practices: 100 (no change from production)
SEO: 91 (no change from production)
PWA: -
View the detailed breakdown and full score reports

To edit notification comments on pull requests, go to your Netlify site configuration.

@literat literat requested a review from crishpeen December 10, 2024 20:12
import { classNamePrefixProviderTest } from '../../../../tests/providerTests/classNamePrefixProviderTest';
import { restPropsTest } from '../../../../tests/providerTests/restPropsTest';
import { stylePropsTest } from '../../../../tests/providerTests/stylePropsTest';
import { classNamePrefixProviderTest, restPropsTest, stylePropsTest } from '@local/tests';
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

todo (if-minor): We need to setup the correct import order. Maybe @curdaj can help with it.

Copy link

netlify bot commented Dec 10, 2024

Deploy Preview for spirit-design-system-storybook ready!

Name Link
🔨 Latest commit 0ff16c0
🔍 Latest deploy log https://app.netlify.com/sites/spirit-design-system-storybook/deploys/6761ad6f194f700008813499
😎 Deploy Preview https://deploy-preview-1807--spirit-design-system-storybook.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.


// A map from regular expressions to module names or to arrays of module names
// https://jestjs.io/docs/configuration#modulenamemapper-objectstring-string--arraystring
moduleNameMapper: {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

suggestion (if-minor): Consider using ts-jest and https://kulshekhar.github.io/ts-jest/docs/getting-started/paths-mapping/

@literat literat force-pushed the refactor/tests-import-alias branch from a8ac61a to 8be5e9c Compare December 17, 2024 12:19
@@ -73,9 +88,14 @@ module.exports = {
{
groups: ['builtin', 'external', 'internal', 'parent', 'sibling', 'index'],
pathGroups: [
// {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

thought (if-minor): It looks like this option have no effect on the current code. @curdaj

@crishpeen
Copy link
Member

FYI, I created two issues for this. As we decided on Long Topics DS-1611, DS-1612.

@literat literat force-pushed the refactor/tests-import-alias branch from 26e8293 to a12fbac Compare December 17, 2024 16:51
@literat literat marked this pull request as ready for review December 17, 2024 16:57
@literat literat requested review from pavelklibani, curdaj and a team as code owners December 17, 2024 16:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
refactoring A code change that neither fixes a bug nor adds a feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants