Skip to content

test(core): implement missing tests for exclude predicate in deployment view#2576

Merged
davydkov merged 1 commit into
likec4:mainfrom
Shrinet82:feat/exclude-predicate-tests
Feb 7, 2026
Merged

test(core): implement missing tests for exclude predicate in deployment view#2576
davydkov merged 1 commit into
likec4:mainfrom
Shrinet82:feat/exclude-predicate-tests

Conversation

@Shrinet82

@Shrinet82 Shrinet82 commented Feb 7, 2026

Copy link
Copy Markdown
Contributor

Implemented the missing test cases for $exclude predicate in deployment-view. Verified that relations can be excluded based on model properties.

Summary by CodeRabbit

  • Tests
    • Enhanced test infrastructure with improved helper utilities and streamlined assertion patterns.

Note: This release contains no user-facing changes. Updates are limited to internal testing infrastructure improvements.

@changeset-bot

changeset-bot Bot commented Feb 7, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 89fb680

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

coderabbitai Bot commented Feb 7, 2026

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

Test file refactored to introduce a new $exclude helper function alongside the existing $include helper. TODO-style placeholders replaced with actual $exclude usage in assertions. Test scaffolding and expectComputedView calls reformatted for conciseness. No modifications to core logic.

Changes

Cohort / File(s) Summary
Test Scaffolding & Helper Updates
packages/core/src/compute-view/deployment-view/predicates/__test__/relations.filter.participant.spec.ts
Added $exclude helper to TestHelper exports. Replaced placeholder TODOs with active $exclude usage in test assertions. Reformatted test setup and expectComputedView calls for improved readability on single lines.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

🐰 Test helpers multiply like carrots in spring,
$exclude joins $include to assert all things,
No logic was broken, just scaffolding refined—
Cleaner assertions for a discerning mind!

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 inconclusive)
Check name Status Explanation Resolution
Description check ❓ Inconclusive The PR description is minimal and lacks the detailed checklist and information specified in the repository template. Complete the PR checklist template including confirmation of testing across screen sizes, documentation updates, and adherence to contribution guidelines.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the main change: implementing missing tests for the exclude predicate in deployment view.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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', () => {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

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.

Comment on lines 69 to 106
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: [],
})
})
})

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

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).

@davydkov

davydkov commented Feb 7, 2026

Copy link
Copy Markdown
Member

Hey @Shrinet82, Great! Thank you!

@davydkov davydkov merged commit 2887fd6 into likec4:main Feb 7, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants