Skip to content

feat add integration-test - #633

Merged
Chucks1093 merged 1 commit into
accesslayerorg:mainfrom
ONEONUORA:add-integration-test
Jul 25, 2026
Merged

feat add integration-test#633
Chucks1093 merged 1 commit into
accesslayerorg:mainfrom
ONEONUORA:add-integration-test

Conversation

@ONEONUORA

Copy link
Copy Markdown
Contributor

Summary

This PR implements four independent improvements across the indexer, webhook, and creator modules.


Changes

1. Indexer — Sell Event Persistence Pipeline

New file:

src/modules/indexer/indexer-pipeline.service.ts

Implements a trade event processing pipeline for on-chain KEY_BOUGHT and KEY_SOLD events sourced from the Soroban indexer.

Features

  • processTradeEvents(events) — entry point; delegates to processIndexerChainEvents for deduplication and sequential processing.
  • Validates eventType.
  • Ensures all required fields are present:
    • creatorId
    • actor
    • amount
    • price
    • feePaid
    • tradeAt
    • ledger
    • txHash
    • eventIndex
  • Skips malformed events with a warn log.
  • For valid events:
    • Creates an Activity record.
    • Calls updateOwnership with a signed balance delta.
    • Upserts CreatorPriceSnapshot.

New file:

src/modules/indexer/indexer-pipeline.integration.test.ts

Includes 3 integration tests covering:

  • Happy path
  • Deduplication
  • Malformed event handling

2. Webhooks — Delivery Attempt Logging

Modified:

src/modules/webhooks/webhook.service.ts

attemptDelivery now emits a structured logger.info after every delivery attempt with:

  • webhook_id
  • event_type
  • attempt_number
  • response_status (HTTP status or null on timeout/error)
  • duration_ms
  • success

The callback URL is never logged.

Modified:

src/modules/webhooks/webhook.service.test.ts

Updated assertions verify:

  • All six logging fields on success
  • Retry paths
  • callbackUrl is absent from every log entry

3. Trading Volume — Rolling Window Boundary Tests

Modified:

src/utils/__tests__/trading-volume.utils.test.ts

Added a Rolling 24-hour Window Boundary Behaviors test suite using fake timers.

Scenario Expected
Trade exactly 24h ago Included (gte is inclusive)
Trade 24h + 1ms ago Excluded
Trade 1 second ago Included
No trades in window Returns 0n

close #624
close #626
close #627
close #628

@drips-wave

drips-wave Bot commented Jul 25, 2026

Copy link
Copy Markdown

@ONEONUORA 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

@Chucks1093
Chucks1093 merged commit 2624eef into accesslayerorg:main Jul 25, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment