Add unit tests for uncovered modules#76
Open
staging-devin-ai-integration[bot] wants to merge 1 commit intomainfrom
Open
Add unit tests for uncovered modules#76staging-devin-ai-integration[bot] wants to merge 1 commit intomainfrom
staging-devin-ai-integration[bot] wants to merge 1 commit intomainfrom
Conversation
…ypewindTransforms - runtime.test.ts: Tests for createRuntimeTw proxy (classes, variants, important, raw, variant helper, arbitrary values, string delegation, Symbol.toPrimitive, complex combinations) - cn.test.ts: Tests for cn() utility (tailwind merge, falsy values, arrays, object syntax, typewind proxy integration) - evaluate.test.ts: Tests for createTw with tailwind context (classes, variants, important, raw, arbitrary values, complex expressions) - utils.test.ts: Tests for loadConfig and createTypewindContext (config shape, candidateRuleMap, variantMap, error on missing config) - typewindTransforms.test.ts: Tests for typewindTransforms export shape - transform.test.ts: Added edge case tests (no-tw passthrough, multiple expressions, js/jsx extensions) - jest.config.js: Updated to use explicit ts-jest config with esModuleInterop for source imports Co-Authored-By: mokshitjain2006+04081@gmail.com <mokshitjain2006@gmail.com>
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds comprehensive unit tests for previously uncovered modules, bringing the test count from 6 to 84. New test files cover:
runtime.test.ts(30 tests):createRuntimeTwproxy — basic classes, chained classes, underscore-to-hyphen conversion,$to@//conversion, variant modifiers (hover, md, dark, nested),important(),raw(),variant(), arbitrary values, slash-separated values,typewind_idsymbol,Symbol.toPrimitive/toString/valueOf, string property delegation (length,includes,split),getPrototypeOftrap, complex multi-variant combinations.cn.test.ts(10 tests):cn()utility — tailwind-merge conflict resolution, falsy values, empty calls, arrays, conditional classes, object syntax, typewind proxy integration viatypewind_id, mixed inputs.evaluate.test.ts(19 tests):createTwwith live tailwind context — mirrors runtime tests but exercises the evaluate module'scandidateRuleMap/variantMap-based proxy (classes, variants, important, raw, variant helper, arbitrary values, symbol access, complex expressions). Usesjest.isolateModulesto avoid cross-test module cache contamination.utils.test.ts(7 tests):loadConfig(default config shape) andcreateTypewindContext(returns Map-based candidateRuleMap/variantMap with standard Tailwind utilities and variants, throws on missing config).typewindTransforms.test.ts(2 tests): Verifies thetypewindTransformsexport shape (tsx/ts/jsx/js keys).transform.test.ts(4 new tests added): Edge cases — no-tw passthrough, multiple tw expressions, js/jsx extension handling.Also updated
jest.config.jsto use explicitts-jestconfiguration withesModuleInterop: true, enabling direct source file imports in tests.Review & Testing Checklist for Human
npm testand verify all 84 tests passjest.config.jschange (switching frompreset: 'ts-jest'to explicittransformconfig withesModuleInterop) doesn't affect any other tooling in your workflowtransform.test.ts.snaplook correct for the added edge case testsNotes
evaluate.test.tsusesjest.isolateModulesfor each test to avoid the top-levelcreateTypewindContext()call inevaluate.tsfrom caching a single tailwind config across test runs.__dirname-based paths instead ofprocess.cwd()to be resilient to cross-file cwd changes from other test suites.typewindTransforms.test.tsintentionally only tests the export shape (not actual transforms) to avoid caching the dist evaluate module with a config that lacks plugins needed by other fixture tests (e.g.,@tailwindcss/container-queries).Link to Devin session: https://staging.itsdev.in/sessions/f530a193b53f4c1192e5d1eb7bb7f27e
Requested by: @Mokshit06