Skip to content

Test: add theme() test cases#274

Merged
github-actions[bot] merged 1 commit intomainfrom
theme-test-code
Nov 8, 2025
Merged

Test: add theme() test cases#274
github-actions[bot] merged 1 commit intomainfrom
theme-test-code

Conversation

@black7375
Copy link
Contributor

@black7375 black7375 commented Nov 5, 2025

Description

Add more test cases.

Related Issue

Summary by CodeRabbit

  • Tests
    • Expanded test coverage for the theme system to improve reliability across many theme scenarios, including unique class name generation, layer handling, primitive and composite token resolution, array and nested token structures, semantic token fallbacks and aliases, unit handling, kebab/camel case normalization, deeply nested themes, global theme integration, and behavior with empty themes.

Additional context

Checklist

@changeset-bot
Copy link

changeset-bot bot commented Nov 5, 2025

⚠️ No Changeset found

Latest commit: 4ef0375

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

@coderabbitai
Copy link

coderabbitai bot commented Nov 5, 2025

Walkthrough

Added an extensive test suite for the theme system in packages/css/src/theme/index.ts, exercising className generation, token resolution (primitive, composite, unit), semantic token behaviors (aliases, fallbacks, raw), @layer handling, nested structures, and global named theme integration. No implementation changes.

Changes

Cohort / File(s) Summary
Theme System Tests
packages/css/src/theme/index.ts
Added comprehensive tests covering: unique className generation with/without debugId; @layer handling; primitive and array token resolution; TokenCompositeValue and TokenUnitValue behaviors; semantic tokens (fallbackVar, alias, raw, complex references); camelCase→kebab-case conversion; deep nesting and mixed token types; globalTheme and empty-theme cases.

Sequence Diagram(s)

(omitted — changes are tests only; no control-flow feature to diagram)

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • Attention areas:
    • Ensure semantic token edge cases (aliasing and fallback resolution) match implementation expectations.
    • Verify @layer and raw extraction assertions reflect intended CSS output.
    • Confirm deep-nesting and mixed-type token tests use correct token normalization (kebab-case, var references).

Possibly related PRs

Poem

🐰 I hop through tokens, var and name,

Layers sorted, none the same.
Aliases find their way to light,
Deep nests pass every test tonight.
A rabbit cheers: the themes are right! 🥕✨

Pre-merge checks and finishing touches

❌ Failed checks (1 inconclusive)
Check name Status Explanation Resolution
Description check ❓ Inconclusive The description is incomplete and vague. It only states 'Add more test cases' without specifics about what is being tested or why. Expand the description with details about which test cases were added, what functionality they cover, and why these tests are important for the theme system.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Test: add theme() test cases' clearly describes the main change—adding test cases for the theme function.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch theme-test-code

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 7a04469 and 4ef0375.

📒 Files selected for processing (1)
  • packages/css/src/theme/index.ts (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/css/src/theme/index.ts
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: pre_job

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link
Contributor

github-actions bot commented Nov 5, 2025

Triggered from #274 by @​black7375.

Checking if we can fast forward main (4a185b4) to theme-test-code (7a04469).

Target branch (main):

commit 4a185b470a8d24ecc6badcb46ea4c0408e486a07 (HEAD -> main, origin/main)
Author: alstjr7375 <alstjr7375@daum.net>
Date:   Sat Sep 27 00:00:00 2025 +0900

    Feat: `theme` - Support `alias` method #270

Pull request (theme-test-code):

commit 7a04469e1bfb5da02c0af0195e0869bcae93691f (pull_request/theme-test-code)
Author: alstjr7375 <alstjr7375@daum.net>
Date:   Tue Nov 4 02:08:14 2025 +0900

    Test: add `theme()` test cases

It is possible to fast forward main (4a185b4) to theme-test-code (7a04469). If you have write access to the target repository, you can add a comment with /fast-forward to fast forward main to theme-test-code.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (2)
packages/css/src/theme/index.ts (2)

1381-1385: Verify the regex pattern matches actual identifier format.

The regex /^[a-zA-Z_][a-zA-Z0-9_]*$/ might not match the actual format generated by generateIdentifier(). Based on the identifierName utility (lines 4-10 in utils.ts), identifiers typically include hash suffixes in the format name__hash. Consider using a pattern that accounts for the hash suffix, or use the identifierName() utility without arguments.

Apply this diff to align with the actual identifier format:

-      expect(className).toMatch(/^[a-zA-Z_][a-zA-Z0-9_]*$/);
+      expect(className).toMatch(identifierName());

1887-1903: Consider whether this integration test adds value.

This test verifies that theme() integrates correctly with globalTheme(). However, since theme() internally calls globalTheme() (line 78), all previous tests are already exercising this integration. This test might be slightly redundant, though it can be kept for explicitness if preferred.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4a185b4 and 7a04469.

📒 Files selected for processing (1)
  • packages/css/src/theme/index.ts (2 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
packages/css/src/theme/index.ts (2)
packages/css/src/index.ts (1)
  • theme (42-42)
packages/css/src/utils.ts (1)
  • identifierName (5-11)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: typecheck
🔇 Additional comments (1)
packages/css/src/theme/index.ts (1)

1372-1910: Excellent test coverage for the theme system!

The test suite is comprehensive and well-structured, covering:

  • ClassName generation (with/without debugId)
  • Token types (primitive, array, nested, TokenDefinition, TokenCompositeValue, TokenUnitValue)
  • Semantic token features (fallbackVar, alias, raw)
  • Edge cases (empty theme, deeply nested structures, mixed types)
  • Complex scenarios (semantic tokens referencing other semantic tokens)

The tests are clear, maintainable, and use proper utilities for normalization and validation.

@github-actions
Copy link
Contributor

github-actions bot commented Nov 5, 2025

Triggered from #274 by @​black7375.

Checking if we can fast forward main (4a185b4) to theme-test-code (4ef0375).

Target branch (main):

commit 4a185b470a8d24ecc6badcb46ea4c0408e486a07 (HEAD -> main, origin/main)
Author: alstjr7375 <alstjr7375@daum.net>
Date:   Sat Sep 27 00:00:00 2025 +0900

    Feat: `theme` - Support `alias` method #270

Pull request (theme-test-code):

commit 4ef03753991571c260a79307cde319486b40d6b4 (pull_request/theme-test-code)
Author: alstjr7375 <alstjr7375@daum.net>
Date:   Fri Oct 10 00:00:00 2025 +0900

    Test: add `theme()` test cases

It is possible to fast forward main (4a185b4) to theme-test-code (4ef0375). If you have write access to the target repository, you can add a comment with /fast-forward to fast forward main to theme-test-code.

@black7375
Copy link
Contributor Author

/fast-forward

@github-actions
Copy link
Contributor

github-actions bot commented Nov 8, 2025

Triggered from #274 (comment) by @​black7375.

Trying to fast forward main (4a185b4) to theme-test-code (4ef0375).

Target branch (main):

commit 4a185b470a8d24ecc6badcb46ea4c0408e486a07 (HEAD -> main, origin/main)
Author: alstjr7375 <alstjr7375@daum.net>
Date:   Sat Sep 27 00:00:00 2025 +0900

    Feat: `theme` - Support `alias` method #270

Pull request (theme-test-code):

commit 4ef03753991571c260a79307cde319486b40d6b4 (pull_request/theme-test-code)
Author: alstjr7375 <alstjr7375@daum.net>
Date:   Fri Oct 10 00:00:00 2025 +0900

    Test: add `theme()` test cases

Fast forwarding main (4a185b4) to theme-test-code (4ef0375).

$ git push origin 4ef03753991571c260a79307cde319486b40d6b4:main
To https://github.com/mincho-js/mincho.git
   4a185b4..4ef0375  4ef03753991571c260a79307cde319486b40d6b4 -> main

@github-actions github-actions bot merged commit 4ef0375 into main Nov 8, 2025
12 checks passed
@github-actions github-actions bot deleted the theme-test-code branch November 8, 2025 07:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant