test(core): implement missing tests for exclude predicate in deployment view#2576
Conversation
|
📝 WalkthroughWalkthroughTest file refactored to introduce a new Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (2 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.
Actionable comments posted: 2
🤖 Fix all issues with AI agents
In
`@packages/core/src/compute-view/deployment-view/predicates/__test__/relations.filter.participant.spec.ts`:
- Around line 69-106: Add symmetric $exclude tests in the "instance" and "node"
describe blocks to mirror the existing $include coverage: for the "instance"
block add tests using $exclude('a.b.c.ui -> a.b.d.api', { where: 'source.tag is
`#next`' }) and $exclude('a.b.c.ui -> a.b.d.api', { where: 'target.tag is `#alpha`'
}) asserting the relation is removed when properties match and retained when
they don't; for the "node" block add $exclude('a.b.d.api -> a.b.d.e', { where:
'target.tag is `#alpha`' }) and $exclude('a.b.d.api -> a.b.d.e', { where:
'target.tag is `#next`' }) with assertions that mirror the corresponding $include
tests (nodes/edges empty when excluded on match, present when not matched).
- Line 48: Several test case descriptions use the misspelled word "porperties";
update each 'it' block title that contains "porperties" to "properties" so the
seven test descriptions read correctly (for example, change the title in the
it('should exclude relation when porperties match', ...) and the six other
it(...) titles that contain "porperties" to use "properties" instead). Ensure
only the string literals for the test names are corrected and no other logic is
changed.
| ) | ||
|
|
||
| describe('model', () => { | ||
| it('should exclude relation when porperties match', () => { |
There was a problem hiding this comment.
Typo: "porperties" → "properties" in seven test descriptions.
The word "porperties" is misspelled across all test names in this file. This affects test output readability and discoverability when filtering by name.
🔤 Proposed fix
- it('should exclude relation when porperties match', () => {
+ it('should exclude relation when properties match', () => {- it('should exclude relation when porperties do not match', () => {
+ it('should exclude relation when properties do not match', () => {- it('should include relation when model porperties match', () => {
+ it('should include relation when model properties match', () => {- it('should include relation when deployment porperties match', () => {
+ it('should include relation when deployment properties match', () => {- it('should not include relation when neither model nor deployment porperties match', () => {
+ it('should not include relation when neither model nor deployment properties match', () => {- it('should include relation when porperties match', () => {
+ it('should include relation when properties match', () => {- it('should include relation when porperties do not match', () => {
+ it('should include relation when properties do not match', () => {Also applies to: 58-58, 70-70, 77-77, 84-84, 93-93, 100-100
🤖 Prompt for AI Agents
In
`@packages/core/src/compute-view/deployment-view/predicates/__test__/relations.filter.participant.spec.ts`
at line 48, Several test case descriptions use the misspelled word "porperties";
update each 'it' block title that contains "porperties" to "properties" so the
seven test descriptions read correctly (for example, change the title in the
it('should exclude relation when porperties match', ...) and the six other
it(...) titles that contain "porperties" to use "properties" instead). Ensure
only the string literals for the test names are corrected and no other logic is
changed.
| describe('instance', () => { | ||
| it('should include relation when model porperties match', () => { | ||
| t.expectComputedView( | ||
| $include('a.b.c.ui -> a.b.d.api', { where: 'source.tag is #next' }), | ||
| ).toHave( | ||
| { | ||
| nodes: [ | ||
| 'a.b.c.ui', | ||
| 'a.b.d', | ||
| 'a.b.d.api', | ||
| ], | ||
| edges: [ | ||
| 'a.b.c.ui -> a.b.d.api', | ||
| ], | ||
| }, | ||
| ) | ||
| t.expectComputedView($include('a.b.c.ui -> a.b.d.api', { where: 'source.tag is #next' })).toHave({ | ||
| nodes: ['a.b.c.ui', 'a.b.d', 'a.b.d.api'], | ||
| edges: ['a.b.c.ui -> a.b.d.api'], | ||
| }) | ||
| }) | ||
|
|
||
| it('should include relation when deployment porperties match', () => { | ||
| t.expectComputedView( | ||
| $include('a.b.c.ui -> a.b.d.api', { where: 'target.tag is #alpha' }), | ||
| ).toHave( | ||
| { | ||
| nodes: [ | ||
| 'a.b.c.ui', | ||
| 'a.b.d', | ||
| 'a.b.d.api', | ||
| ], | ||
| edges: [ | ||
| 'a.b.c.ui -> a.b.d.api', | ||
| ], | ||
| }, | ||
| ) | ||
| t.expectComputedView($include('a.b.c.ui -> a.b.d.api', { where: 'target.tag is #alpha' })).toHave({ | ||
| nodes: ['a.b.c.ui', 'a.b.d', 'a.b.d.api'], | ||
| edges: ['a.b.c.ui -> a.b.d.api'], | ||
| }) | ||
| }) | ||
|
|
||
| it('should not include relation when neither model nor deployment porperties match', () => { | ||
| t.expectComputedView( | ||
| $include('a.b.c.ui -> a.b.d.api', { where: 'source.tag is #alpha' }), | ||
| ).toHave( | ||
| { | ||
| nodes: [], | ||
| edges: [], | ||
| }, | ||
| ) | ||
| t.expectComputedView($include('a.b.c.ui -> a.b.d.api', { where: 'source.tag is #alpha' })).toHave({ | ||
| nodes: [], | ||
| edges: [], | ||
| }) | ||
| }) | ||
| }) | ||
|
|
||
| describe('node', () => { | ||
| it('should include relation when porperties match', () => { | ||
| t.expectComputedView( | ||
| $include('a.b.d.api -> a.b.d.e', { where: 'target.tag is #alpha' }), | ||
| ).toHave( | ||
| { | ||
| nodes: [ | ||
| 'a.b.d.api', | ||
| 'a.b.d.e', | ||
| ], | ||
| edges: [ | ||
| 'a.b.d.api -> a.b.d.e', | ||
| ], | ||
| }, | ||
| ) | ||
| t.expectComputedView($include('a.b.d.api -> a.b.d.e', { where: 'target.tag is #alpha' })).toHave({ | ||
| nodes: ['a.b.d.api', 'a.b.d.e'], | ||
| edges: ['a.b.d.api -> a.b.d.e'], | ||
| }) | ||
| }) | ||
|
|
||
| it('should include relation when porperties do not match', () => { | ||
| t.expectComputedView( | ||
| $include('a.b.d.api -> a.b.d.e', { where: 'target.tag is #next' }), | ||
| ).toHave( | ||
| { | ||
| nodes: [], | ||
| edges: [], | ||
| }, | ||
| ) | ||
| t.expectComputedView($include('a.b.d.api -> a.b.d.e', { where: 'target.tag is #next' })).toHave({ | ||
| nodes: [], | ||
| edges: [], | ||
| }) | ||
| }) | ||
| }) |
There was a problem hiding this comment.
Missing $exclude tests in "instance" and "node" describe blocks.
The PR objective is to implement missing tests for the $exclude predicate, but only the "model" section (lines 47–66) has $exclude tests. The "instance" and "node" sections only test $include. Consider adding symmetric $exclude test cases here — e.g., verifying that $exclude with matching model/deployment/node properties correctly removes the relation, and that non-matching properties leave it intact.
🤖 Prompt for AI Agents
In
`@packages/core/src/compute-view/deployment-view/predicates/__test__/relations.filter.participant.spec.ts`
around lines 69 - 106, Add symmetric $exclude tests in the "instance" and "node"
describe blocks to mirror the existing $include coverage: for the "instance"
block add tests using $exclude('a.b.c.ui -> a.b.d.api', { where: 'source.tag is
`#next`' }) and $exclude('a.b.c.ui -> a.b.d.api', { where: 'target.tag is `#alpha`'
}) asserting the relation is removed when properties match and retained when
they don't; for the "node" block add $exclude('a.b.d.api -> a.b.d.e', { where:
'target.tag is `#alpha`' }) and $exclude('a.b.d.api -> a.b.d.e', { where:
'target.tag is `#next`' }) with assertions that mirror the corresponding $include
tests (nodes/edges empty when excluded on match, present when not matched).
|
Hey @Shrinet82, Great! Thank you! |
Implemented the missing test cases for
$excludepredicate indeployment-view. Verified that relations can be excluded based on model properties.Summary by CodeRabbit
Note: This release contains no user-facing changes. Updates are limited to internal testing infrastructure improvements.