Overview
Testing social media integrations requires careful attention to OAuth flows, API rate limits, and platform-specific behaviors. This guide covers strategies for testing providers effectively.Testing Strategy
Test Pyramid
Unit Tests
Testing OAuth URL Generation
example.provider.spec.ts
Testing Error Handling
Integration Tests
Mocking Platform APIs
Testing Authentication Flow
Testing Post Publishing
Manual Testing
OAuth Flow Testing
Post Publishing Testing
Error Scenario Testing
Platform-Specific Testing
Twitter/X Testing
- Test with premium and non-premium accounts (different character limits)
- Test media uploads (4 images max, 1 video max)
- Test thread creation
- Verify duplicate detection works
LinkedIn Testing
- Test both personal and company page posting
- Test document uploads (PDFs)
- Test carousel posts (2-10 images)
- Verify mentions work correctly
Facebook/Instagram Testing
- Test different media formats
- Test first comment feature
- Test carousel posts
- Verify location tagging
Automated E2E Tests
e2e/integrations.spec.ts
Testing Checklist
OAuth Flow
- Authorization URL generation
- State parameter validation
- Code exchange for token
- Scope validation
- User profile fetch
Token Management
- Token storage
- Token refresh before expiry
- Expired token handling
- Invalid token handling
Post Publishing
- Text-only posts
- Posts with images
- Posts with videos
- Multiple media items
- Character limit enforcement
Error Handling
- Network errors
- Rate limit errors
- Invalid media errors
- Insufficient permissions
- Duplicate post detection
Debugging Tips
Enable Request Logging
Test with Sandbox Accounts
Many platforms provide sandbox/test accounts:- Use sandbox accounts for development
- Avoid posting to real accounts during testing
- Some platforms have test API endpoints
Best Practices
- Test with real APIs in development, but use mocks for CI/CD
- Store test credentials securely, never commit them
- Clean up test data after running tests
- Test error scenarios as thoroughly as happy paths
- Monitor rate limits to avoid getting banned
- Use test accounts separate from production
Next Steps
Contributing Guidelines
Learn how to contribute your provider
Code Standards
Follow code standards and conventions