You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

1.7 KiB

Test API Server Setup

Overview

The Test API Server provides mock endpoints for testing the Daily Notification Plugin's network functionality, including ETag support, error handling, and content fetching.

Quick Setup

# Navigate to test-api directory
cd test-apps/test-api

# Install dependencies
npm install

# Start server
npm start

Integration with Test Apps

Update Test App Configuration

Add the API base URL to your test app configuration:

// In your test app's config
const API_CONFIG = {
  baseUrl: 'http://localhost:3001', // Adjust for platform
  endpoints: {
    content: '/api/content',
    health: '/health',
    error: '/api/error',
    metrics: '/api/metrics'
  }
};

Platform-Specific URLs

  • Web/Electron: http://localhost:3001
  • Android Emulator: http://10.0.2.2:3001
  • iOS Simulator: http://localhost:3001
  • Physical Devices: http://[YOUR_IP]:3001

Testing Workflow

  1. Start API Server: npm start in test-apps/test-api/
  2. Start Test App: Run your platform-specific test app
  3. Test Scenarios: Use the test app to validate plugin functionality
  4. Monitor API: Check /api/metrics for usage statistics

Available Test Scenarios

Content Fetching

  • Basic content retrieval
  • ETag conditional requests
  • Content updates and caching

Error Handling

  • Network timeouts
  • Server errors
  • Rate limiting
  • Authentication failures

Performance Testing

  • Concurrent requests
  • Memory usage monitoring
  • Long-running scenarios

Next Steps

  1. Start the API server
  2. Configure your test apps to use the API
  3. Run through the test scenarios
  4. Validate plugin functionality across platforms