Skip to content

test(agent): add test coverage for completeShutdown - #914

Open
Fathia-tech14 wants to merge 1 commit into
Stellar-Ecosystem:mainfrom
Fathia-tech14:test/827-complete-shutdown-coverage
Open

test(agent): add test coverage for completeShutdown#914
Fathia-tech14 wants to merge 1 commit into
Stellar-Ecosystem:mainfrom
Fathia-tech14:test/827-complete-shutdown-coverage

Conversation

@Fathia-tech14

Copy link
Copy Markdown

Resolves #827

Summary of Changes

  • Exported completeShutdown from agent/agent.js.
  • Added a dedicated unit test suite in agent/completeShutdown.test.js (20 tests) covering:
    • Exit Code Mapping: Verifies exit code 0 on success = true (and truthy boundaries 1, "true") and exit code 1 on success = false (and falsy boundaries 0, null, undefined, "", NaN).
    • Structured Logging: Asserts shutdown_complete payload contains accurate success, unresolvedPayments, and finalScore fields.
    • Pending Timer Cancellation: Ensures active shutdownTimer (initiated via initiateShutdown) is cleared with clearTimeout.
    • Resource Cleanup: Confirms dispose() is called prior to process termination.
    • Isolation: Dependencies, process lifecycle, and timers are mocked without making real network or contract calls.

Verification

Ran npx vitest run in agent/:

✓ runSummary.test.js (20 tests)
✓ completeShutdown.test.js (20 tests)
✓ agent.test.js (30 tests)

Test Files  3 passed (3)
     Tests  70 passed (70)

- Export completeShutdown from agent/agent.js
- Add agent/completeShutdown.test.js with 20 unit tests covering exit code mapping, shutdown timer cancellation, structured event logging, resource disposal, and boundary conditions
- Resolves Stellar-Ecosystem#827
@drips-wave

drips-wave Bot commented Aug 30, 2026

Copy link
Copy Markdown

@Fathia-tech14 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@coderabbitai

coderabbitai Bot commented Aug 30, 2026

Copy link
Copy Markdown
Contributor

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 6cb233be-b78d-43c7-98d8-290212584f2d


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.

@Fathia-tech14

Copy link
Copy Markdown
Author

@Stellar-Ecosystem Hi! This PR is open and ready for review — happy to address any feedback. Thanks!

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.

Agent: add test coverage for completeShutdown

1 participant