Skip to content

Conversation

brianacnguyen
Copy link
Contributor

Description

This PR adds a comprehensive test suite for the package @metamask/design-system-twrnc-preset

Related issues

Fixes: #732

Manual testing steps

  1. Go to packages/design-system-twrnc-preset
  2. Run yarn test

Screenshots/Recordings

Before

After

Pre-merge author checklist

  • I've followed MetaMask Contributor Docs
  • I've completed the PR template to the best of my ability
  • I’ve included tests if applicable
  • I’ve documented my code using JSDoc format if applicable
  • I’ve applied the right labels on the PR (see labeling guidelines). Not required for external contributors.

Pre-merge reviewer checklist

  • I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
  • I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.

@brianacnguyen brianacnguyen self-assigned this Jun 11, 2025
@brianacnguyen brianacnguyen requested a review from a team as a code owner June 11, 2025 22:16
Copy link
Contributor

📖 Storybook Preview

cursor[bot]

This comment was marked as outdated.

Copy link
Contributor

📖 Storybook Preview

Copy link

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Updated@​babel/​runtime@​7.26.0 ⏵ 7.27.6100 +1100 +57897100

View full report

Copy link
Contributor

📖 Storybook Preview

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

✅ BugBot reviewed your changes and found no bugs!


Was this report helpful? Give feedback by reacting with 👍 or 👎

@georgewrmarshall georgewrmarshall marked this pull request as draft June 30, 2025 15:27
@georgewrmarshall georgewrmarshall requested a review from Copilot July 16, 2025 15:57
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds a comprehensive test suite for the @metamask/design-system-twrnc-preset package, addressing issue #732. The test suite includes complete coverage for all major components and functionality of the design system preset.

  • Adds unit tests for all modules including typography, colors, themes, hooks, and configuration generation
  • Adds test infrastructure with Jest configuration and proper coverage settings
  • Includes a minor bug fix in the colors module's flattenColors function

Reviewed Changes

Copilot reviewed 11 out of 12 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/typography.types.test.ts Tests for typography type definitions and interfaces
src/typography.test.ts Tests for typography configuration and design tokens
src/tailwind.config.test.ts Tests for Tailwind configuration generation logic
src/index.test.ts Tests for package exports and public API
src/hooks.test.tsx Tests for React hooks (useTheme, useTailwind)
src/colors.test.ts Tests for color system and theme color handling
src/ThemeProvider.test.tsx Tests for React context provider component
src/Theme.types.test.ts Tests for theme enum and type definitions
src/colors.ts Bug fix for flattenColors function logic
package.json Added react-native dev dependency for testing
jest.config.js Updated Jest configuration with coverage settings

Comment on lines +62 to +64
}

if (typeof value === 'object' && value !== null) {
Copy link
Preview

Copilot AI Jul 16, 2025

Choose a reason for hiding this comment

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

The logic change from else if to separate if statements will cause string values to be processed twice - once as strings and once as potential objects. This could lead to incorrect flattening behavior where string values might be treated as objects if they have object-like properties.

Suggested change
}
if (typeof value === 'object' && value !== null) {
} else if (typeof value === 'object' && value !== null) {

Copilot uses AI. Check for mistakes.

@georgewrmarshall
Copy link
Contributor

@cursoragent review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[TWRNC] Add comprehensive test suite
2 participants