this repo has no description
README.md

Attoshi E2E Tests#

Real end-to-end tests for the Attoshi token system. These tests use actual AT Protocol accounts to verify the full flow:

  1. Follow → Issuance - Following the entity DID triggers token issuance
  2. Cashtag → Transfer - $attoshi <amount> in a reply transfers tokens to the parent author
  3. Balance/UTXO queries - Verify balances and UTXOs
  4. State reset - Clean slate for next test run

Prerequisites#

You need 2 existing Bluesky accounts for testing. Create them at bsky.app if you don't have them.

Setup#

Option 1: Interactive Setup#

bun tests/e2e/setup-accounts.ts

This will prompt you for credentials and output the environment variables to set.

Option 2: Manual Setup#

  1. Create app passwords for your test accounts at bsky.app/settings/app-passwords

  2. Get session tokens by calling createSession:

curl -X POST "https://bsky.social/xrpc/com.atproto.server.createSession" \
  -H "Content-Type: application/json" \
  -d '{"identifier": "your-handle.bsky.social", "password": "your-app-password"}'
  1. Set environment variables:
export AUTH_TOKEN="your-attoshi-admin-token"
export TEST_ACCOUNT_1_DID="did:plc:xxxxx"
export TEST_ACCOUNT_1_JWT="eyJ..."
export TEST_ACCOUNT_1_PDS="https://bsky.social"
export TEST_ACCOUNT_2_DID="did:plc:yyyyy"
export TEST_ACCOUNT_2_JWT="eyJ..."
export TEST_ACCOUNT_2_PDS="https://bsky.social"

Running Tests#

# Run E2E tests
bun test tests/e2e/real-flow.test.ts

# Or via npm script
bun test:e2e

What the Tests Do#

  1. Reset state to clean slate (0 issuances)
  2. Account 1 follows the entity → receives issuance tokens
  3. Account 2 follows the entity → receives issuance tokens
  4. Account 2 creates a post
  5. Account 1 replies with $attoshi 10 → transfers 10 tokens to Account 2
  6. Verify balances changed correctly
  7. Query UTXOs and transactions
  8. Cleanup - delete follow records, reset state to 0

Notes#

  • JWTs expire after ~2 hours. Re-run setup if tests fail with auth errors.
  • The tests wait for the firehose to process events (3-6 seconds per action).
  • State is reset at the start and end of tests for clean slate testing.