Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: Integration Tests Enhancement and Coinbase Commerce Integration #1767

Merged
merged 18 commits into from
Jan 10, 2025

Conversation

pgoos
Copy link
Contributor

@pgoos pgoos commented Jan 3, 2025

Integration Tests Enhancement and Coinbase Commerce Integration

Changes

Integration Tests Framework

  • Enhanced test runner to support test descriptions and conditional test skipping
  • Added proper test output formatting with descriptive messages
  • Modified send() function to return full response data instead of just text
  • Added support for environment variable-based test skipping

Coinbase Commerce Integration

  • Fixed URL construction in getChargeDetails by adding missing slash
  • Updated attachment handling in commerce actions:
    // Use actual charge ID instead of random UUID
    - id: crypto.randomUUID(),
    + id: chargeResponse.id,
    // Use hosted URL instead of charge ID
    - url: chargeResponse.id,
    + url: chargeResponse.hosted_url,
  • Added proper content type and improved attachment structure
  • Enhanced charge details response with better formatting

Test Coverage

  • Added comprehensive test suite for Coinbase Commerce functionality:
    • Charge creation
    • Charge listing
    • Charge details retrieval
  • Added proper assertions for response structure and data validation
  • Improved error messages for better debugging

CI/CD

  • Updated GitHub Actions workflow to properly handle environment variables:
    env:
      OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
      COINBASE_COMMERCE_KEY: ${{ secrets.COINBASE_COMMERCE_KEY }}
  • Removed redundant API key check since tests now handle missing keys gracefully

Testing

The PR includes extensive integration tests that verify:

  • Basic agent communication
  • Coinbase Commerce charge lifecycle
  • Response structure and data validation
  • Error handling and edge cases

Tests can be run locally with:

pnpm run integrationTests

Note: Tests require valid OPENAI_API_KEY and COINBASE_COMMERCE_KEY environment variables to be set.

Dependencies

  • Updated various dependencies to their latest versions
  • Fixed compatibility issues with updated packages

@pgoos pgoos changed the base branch from main to develop January 3, 2025 15:57
tests/test1.mjs Outdated
// Verify charge creation response
const chargeResponse = response[1];
assert(chargeResponse.text.startsWith("Charge created successfully:"), "Should indicate successful charge creation");
assert(chargeResponse.text.includes("https://commerce.coinbase.com/pay/"), "Should contain valid Coinbase Commerce URL");

Check failure

Code scanning / CodeQL

Incomplete URL substring sanitization High test

'
https://commerce.coinbase.com/pay/
' can be anywhere in the URL, and arbitrary hosts may come before or after it.
tests/test1.mjs Outdated
assert(attachment.url, "Should have a charge ID URL");
assert(attachment.description.startsWith("Charge ID:"), "Should have charge ID description");
assert(attachment.text.startsWith("Pay here:"), "Should have payment URL");
assert(attachment.text.includes("https://commerce.coinbase.com/pay/"), "Should have valid Coinbase Commerce URL");

Check failure

Code scanning / CodeQL

Incomplete URL substring sanitization High test

'
https://commerce.coinbase.com/pay/
' can be anywhere in the URL, and arbitrary hosts may come before or after it.
@pgoos pgoos changed the title Test: coinbase commerce integration test Test: Integration Tests Enhancement and Coinbase Commerce Integration Jan 3, 2025
@monilpat monilpat changed the title Test: Integration Tests Enhancement and Coinbase Commerce Integration test: Integration Tests Enhancement and Coinbase Commerce Integration Jan 3, 2025
@monilpat monilpat merged commit defe7e4 into elizaOS:develop Jan 10, 2025
4 checks passed
@monilpat monilpat deleted the piotr/coinbase-plugin-tests branch January 10, 2025 20:41
0xpi-ai pushed a commit to 0xpi-ai/NayariAI that referenced this pull request Jan 15, 2025
…ests

test: Integration Tests Enhancement and Coinbase Commerce Integration
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.

3 participants