-
Notifications
You must be signed in to change notification settings - Fork 40
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
test(table): add table utils has-common test #526
Conversation
WalkthroughA new test file Changes
Poem
✨ Finishing Touches
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this 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 (4)
packages/table-module/__tests__/utils/has-common.test.ts (4)
21-24
: Consider improving test isolation.Creating and setting up the editor in the describe block could lead to state sharing between tests. Consider moving the editor creation and setup into
beforeEach
to ensure each test starts with a fresh editor state.describe('hasCommon', () => { - const editor = createEditor() - setEditorSelection(editor) + let editor: core.IDomEditor + + beforeEach(() => { + editor = createEditor() + setEditorSelection(editor) + })
87-87
: Translate comment to English for consistency.The Chinese comment
// 插入 divider
should be in English.- editor.insertNode(elem) // 插入 divider + editor.insertNode(elem) // Insert table element
26-91
: Consider adding more assertions and edge cases.While the test correctly verifies the basic functionality, consider:
- Testing with different depths of common ancestors
- Adding assertions to verify the table structure was inserted correctly
- Testing with invalid or malformed paths
21-100
: Enhance test coverage with additional scenarios.Consider adding test cases for:
- Null/undefined paths
- Empty path arrays
- Invalid node types
- Deeply nested structures
- Multiple paths with mixed common/non-common ancestors
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
packages/table-module/__tests__/utils/has-common.test.ts
(1 hunks)tsconfig.json
(2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (2)
- GitHub Check: test
- GitHub Check: test-e2e
🔇 Additional comments (3)
packages/table-module/__tests__/utils/has-common.test.ts (2)
5-19
: Well-structured test setup!Good job on the imports organization and the typed helper function implementation.
93-99
: Verify type parameter consistency.The first test uses
'tr'
as the type parameter forhasCommon
, while this test uses'table'
. Ensure this difference is intentional and document the reason if it is.tsconfig.json (1)
30-32
: LGTM! Configuration changes look good.The addition of Vitest globals and test file patterns is appropriate for supporting the new test implementation.
Also applies to: 41-42
Changes Overview
Implementation Approach
Testing Done
Verification Steps
Additional Notes
Checklist
Related Issues
Summary by CodeRabbit
hasCommon
utility function