Skip to content

feat: add blockchain-to-notification end-to-end tests - #930

Open
pimaster900 wants to merge 2 commits into
Core-Foundry:mainfrom
pimaster900:feat/blockchain-to-notification-e2e-tests
Open

pimaster900 wants to merge 2 commits into
Core-Foundry:mainfrom
pimaster900:feat/blockchain-to-notification-e2e-tests

Conversation

@pimaster900

Copy link
Copy Markdown

Add end-to-end test coverage for the complete NotifyChain pipeline:
Blockchain Event → Listener → Validation → Database → Scheduler → Notification

New file:

  • listener/src/tests/blockchain-to-notification-e2e.test.ts 7 describe blocks, 46 test cases covering:
    • Stage 1: RPC response validation, event payload validation, event filter matching, event name extraction
    • Stage 2: EventRegistry (in-memory store) — add, retrieve, evict, clear
    • Stage 3: NotificationDeduplicator — window-based suppression, metrics
    • Stage 4: EventSubscriber with mocked RPC server — happy path, invalid RPC, invalid payload, filter mismatch, full-contract failure
    • Stage 5: NotificationAPI + SQLite — schedule, reject past date, reject missing recipient, reject null payload
    • Stage 6: NotificationScheduler — delivery, failure, not-yet-due, batch delivery
    • Stage 7: Full pipeline — event → registry → DB → scheduler → delivery, duplicate suppression, filter rejection, delivery failure, batch

Fixes and improvements to unblock tests:

  • listener/src/services/event-subscriber.ts: remove duplicate processableEvents declaration and duplicate request declaration left behind from a merge conflict; add missing backfillStartLedger private field
  • listener/src/services/discord-notification.ts: fix missing closing brace on sanitizeForDiscord() left behind from a merge conflict
  • listener/src/mocks/@stellar/stellar-sdk.ts: add xdr.ScVal stub (scvSymbol, scvString, scvU32) with singleton ScValType constants for switch-case equality, and scValToNative() so formatScVal works in tests without the real Stellar SDK installed

Overview

Related Issue

Closes #

Changes

Verification

# e.g.
cd dashboard && npm test
cd listener && npm run typecheck && npm test
cd contract/contracts/hello-world && cargo test

How to Test

Checklist

  • Branch is up to date with main
  • Tests added/updated and all pass locally
  • cargo fmt --all run (if Rust changes)
  • npm run lint passes (if TypeScript changes)
  • Documentation updated if behavior changed

closes #796

Add end-to-end test coverage for the complete NotifyChain pipeline:
  Blockchain Event → Listener → Validation → Database → Scheduler → Notification

New file:
- listener/src/__tests__/blockchain-to-notification-e2e.test.ts
  7 describe blocks, 46 test cases covering:
  - Stage 1: RPC response validation, event payload validation,
    event filter matching, event name extraction
  - Stage 2: EventRegistry (in-memory store) — add, retrieve, evict, clear
  - Stage 3: NotificationDeduplicator — window-based suppression, metrics
  - Stage 4: EventSubscriber with mocked RPC server — happy path, invalid
    RPC, invalid payload, filter mismatch, full-contract failure
  - Stage 5: NotificationAPI + SQLite — schedule, reject past date,
    reject missing recipient, reject null payload
  - Stage 6: NotificationScheduler — delivery, failure, not-yet-due,
    batch delivery
  - Stage 7: Full pipeline — event → registry → DB → scheduler → delivery,
    duplicate suppression, filter rejection, delivery failure, batch

Fixes and improvements to unblock tests:
- listener/src/services/event-subscriber.ts: remove duplicate
  processableEvents declaration and duplicate request declaration
  left behind from a merge conflict; add missing backfillStartLedger
  private field
- listener/src/services/discord-notification.ts: fix missing closing
  brace on sanitizeForDiscord() left behind from a merge conflict
- listener/src/__mocks__/@stellar/stellar-sdk.ts: add xdr.ScVal stub
  (scvSymbol, scvString, scvU32) with singleton ScValType constants
  for switch-case equality, and scValToNative() so formatScVal works
  in tests without the real Stellar SDK installed
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.

Add End-to-End Notification Pipeline Tests

1 participant