chore(entities): Layer 1 unit tests for @agenta/entities molecules#4339
Conversation
…ion functions - Implement unit tests for createEntityDraftState in draft-state.test.ts, covering initial state, updates, draft clearing, and custom isDirty functionality. - Add tests for loadable store functionality in loadable-store.test.ts, including default state, mode switching, connected source updates, and instance isolation. - Create tests for normalizeValueForComparison in normalize.test.ts, ensuring correct handling of various data types and structures. - Configure Vitest to output test results in JUnit format and set up coverage reporting in vitest.config.ts. - Generate initial JUnit test results file for CI integration.
…et molecule - Implemented unit tests for revision table state atoms and reducers, covering initial state, column and row operations, and pending changes. - Created unit tests for testcase molecule, validating molecule shape, ID tracking, actions, and selection draft operations. - Added unit tests for testset molecule, focusing on filter atoms, draft operations, local entity creation, and null-safe selectors. - Updated Vitest configuration to include path aliasing for @agenta/ui to avoid unnecessary transformations during testing.
- Implement comprehensive unit tests for environmentMolecule covering molecule shape, isNewEntity, draft operations, null-safe selectors, and lifecycle. - Introduce unit tests for traceSpanMolecule focusing on molecule shape, local data API, derived atoms, draft operations, isNew detection, and lifecycle management.
…lts and coverage Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
📝 WalkthroughWalkthroughThis pull request adds a comprehensive Vitest unit testing infrastructure for the ChangesTest Suite Implementation
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (2)
web/packages/agenta-entities/tests/unit/draft-state.test.ts (1)
22-26: ⚡ Quick winUse
interfacefor theNoteobject shape.Replace the
type Note = { ... }declaration with aninterface Note { ... }to match repository TypeScript conventions.As per coding guidelines,
**/*.{ts,tsx}: Prefer interface for defining object shapes in TypeScript.web/packages/agenta-entities/tests/unit/molecule.test.ts (1)
24-28: ⚡ Quick winUse
interfacefor thePostobject shape.Switch
type Post = { ... }tointerface Post { ... }to align with the project’s TypeScript style rule.As per coding guidelines,
**/*.{ts,tsx}: Prefer interface for defining object shapes in TypeScript.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 61bbb062-768e-4316-aab6-7f03a8e42c31
⛔ Files ignored due to path filters (1)
web/pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (17)
web/packages/agenta-entities/.gitignoreweb/packages/agenta-entities/package.jsonweb/packages/agenta-entities/src/testset/state/paginatedStore.tsweb/packages/agenta-entities/tests/__mocks__/agenta-ui.tsweb/packages/agenta-entities/tests/unit/__smoke__/entity-imports.test.tsweb/packages/agenta-entities/tests/unit/draft-state.test.tsweb/packages/agenta-entities/tests/unit/environment-molecule.test.tsweb/packages/agenta-entities/tests/unit/loadable-store.test.tsweb/packages/agenta-entities/tests/unit/local-molecule.test.tsweb/packages/agenta-entities/tests/unit/molecule.test.tsweb/packages/agenta-entities/tests/unit/normalize.test.tsweb/packages/agenta-entities/tests/unit/port-helpers.test.tsweb/packages/agenta-entities/tests/unit/revision-table-state.test.tsweb/packages/agenta-entities/tests/unit/testcase-molecule.test.tsweb/packages/agenta-entities/tests/unit/testset-molecule.test.tsweb/packages/agenta-entities/tests/unit/trace-span-molecule.test.tsweb/packages/agenta-entities/vitest.config.ts
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: af09aaae77
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Railway Preview Environment
Updated at 2026-05-19T18:18:37.295Z |
Summary
Adds a complete Layer 1 (pure Jotai, no backend) unit test suite for the
@agenta/entitiespackage. All tests run in a Node environment via Vitest with a plaincreateStore()per test for full isolation.327 tests across 12 files, passing in < 6 s.
What's covered
molecule.test.tscreateMoleculefactory (draft, isDirty, lifecycle, cleanup)local-molecule.test.tscreateLocalMoleculefactory (inline entities, isNew)draft-state.test.tsnormalize.test.tsnormalizeValueForComparisonutilityloadable-store.test.tsloadableStoreatoms and actionsport-helpers.test.tsrevision-table-state.test.tstestset-molecule.test.tstestsetMolecule(filters, draft, null-safe selectors)testcase-molecule.test.tstestcaseMolecule(add/delete/create, selection draft)trace-span-molecule.test.tstraceSpanMolecule(local.set seeding, derived atoms, getAgDataPath)environment-molecule.test.tsenvironmentMolecule(deployments, revisionsList, lifecycle)__smoke__/entity-imports.test.tsInfrastructure added
vitest.config.ts— Node environment, JUnit reporter, v8 coveragetests/__mocks__/agenta-ui.ts— Lightweight stub that prevents the antd transform timeout (antd pulls in a large ESM tree that Vitest can't transform in time; this stub redirects@agenta/uiimports without touching the real package)web/packages/agenta-entities/.gitignore— Excludes generatedtest-results/andcoverage/from gitBug fix included
src/testset/state/paginatedStore.ts—testsetsExportFormatAtomusedatomWithStoragewithout a customstorageAdapter, which accessedlocalStorageat module scope and threw in Node. Fixed by passingstringStoragefrom@agenta/shared/stateas the third argument.Test plan
cd web/packages/agenta-entities && pnpm vitest run— all 327 tests passpnpm vitest run --coverage— coverage report generated undercoverage/test-results/andcoverage/are not committed (excluded by.gitignore)🤖 Generated with Claude Code