Payment testing
Unit Testing (Mocked)
Payment Tracking Tests
import { createInMemoryPaymentStorage, createPaymentTracker } from '@regent/x402';
// Create in-memory storage for tests
const storage = createInMemoryPaymentStorage();
const tracker = createPaymentTracker(storage);
// Record test payments
await tracker.recordIncoming(
'test-group',
'global',
'test-route',
1.5,
'0xPayerAddress'
);
// Verify tracking
const summary = await tracker.getIncomingSummary({
startTime: Date.now() - 3600000,
endTime: Date.now(),
});Policy Tests
Paywall Middleware Tests
Integration Testing (Testnet)
Prerequisites
Test Flow
Storage Backend Tests
E2E Test Checklist
Mock Facilitator
Running Tests
Related Resources
Last updated