Repository navigation
test(language/lint): add unit tests for empty-block pass - #48
Merged
Merged
Conversation
Adds 5 unit tests for the empty-block lint pass in packages/language/src/lint/empty-block.ts, which flags `inputs:` or `outputs:` blocks that have no entries. Coverage: - Bare `inputs:` and `outputs:` (null-ish value) → flagged - Populated blocks → not flagged - Both blocks empty → two diagnostics - Multiple actions → one diagnostic per affected action Follows the same test pattern as required-fields.test.ts (salesforce#38). All tests pass via: pnpm --filter @agentscript/language test empty-block
awli
approved these changes
Jun 10, 2026
awli
left a comment
Contributor
There was a problem hiding this comment.
Thanks for the contribution!
This was referenced Jun 11, 2026
6 of 7 tasks
setu4993
pushed a commit
that referenced
this pull request
Sep 3, 2026
Adds 5 unit tests for the unreachable-code lint pass in packages/language/src/lint/unreachable-code.ts, which detects code that follows a terminal statement (transition, or an if/else where all branches transition). Coverage: - Code after a transition → flagged - Procedure ending in a transition → not flagged - Code after a fully-transitioning if/else → flagged - Code after a half-transitioning if/else → not flagged - Unreachable code inside a nested if body → flagged Follows the same test pattern as required-fields.test.ts (#38), empty-block.test.ts (#48), and unused-variable.test.ts (#60). All tests pass via: pnpm --filter @agentscript/language test unreachable-code
dsorajisto
added a commit
to dsorajisto/agentscript
that referenced
this pull request
Oct 18, 2026
Adds 5 unit tests for the unused-variable lint pass in packages/language/src/lint/unused-variable.ts, which flags variables declared in the `variables:` block that are never referenced via `@variables.<name>` expressions elsewhere. Coverage: - Declared-but-unreferenced variable → flagged - Variable referenced in an expression → not flagged - Mixed used/unused → only the unused ones flagged - One diagnostic per unused variable when multiple are unused - No `variables:` block → no diagnostics Follows the same test pattern as required-fields.test.ts (salesforce#38) and empty-block.test.ts (salesforce#48). All tests pass via: pnpm --filter @agentscript/language test unused-variable
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.
What
Adds 5 unit tests for the
empty-blocklint pass inpackages/language/src/lint/empty-block.ts. Brings the rule's test count from 0 to 5.Why
The
empty-blockrule flags emptyinputs:andoutputs:blocks (a common authoring mistake) but had no tests pinning down its behavior. This change closes the gap using the same pattern PR #38 (required-fields.test.ts) established for lint-rule tests.How
New test file at
packages/language/src/lint/empty-block.test.tsusing vitest. Followsrequired-fields.test.tsexactly: singledescribeblock, flatitcases, sharedgetDiagnosticshelper,ActionsBlock-based test schema.The 5 cases:
inputs:with no entriesinputs:blockoutputs:with no entriesinputs:andoutputs:are emptyTest Plan
Result:
pnpm --filter @agentscript/language test empty-block— 5/5 passingnpx eslint --config eslint.config.js packages/language/src/lint/empty-block.test.ts— exit 0Checklist