// Test script for Mastodon client with mock fallback
import mastodonClient from './build/src/platforms/mastodon/client.js';
import { SocialPlatform } from './build/src/types/index.js';
async function testMastodonClient() {
console.log('Testing Mastodon client with mock fallback...');
try {
// Create test content
const content = {
text: `Test toot from Social Media MCP Server - ${new Date().toISOString()}`,
platform: SocialPlatform.MASTODON
};
// Post to Mastodon
console.log('Posting to Mastodon...', { content: content.text });
const postResult = await mastodonClient.postStatus(content);
// Log result
console.log('Mastodon post result:', JSON.stringify(postResult, null, 2));
// Get trending tags
console.log('Getting trending tags from Mastodon...');
const trendingTags = await mastodonClient.getTrendingTags(5);
// Log trending tags
console.log('Mastodon trending tags:', JSON.stringify(trendingTags, null, 2));
// If post was successful, get engagement metrics
if (postResult.success && postResult.postId) {
console.log('Getting engagement metrics for post:', postResult.postId);
const metrics = await mastodonClient.getEngagementMetrics(postResult.postId);
// Log metrics
console.log('Mastodon engagement metrics:', JSON.stringify(metrics, null, 2));
}
console.log('Test completed successfully!');
} catch (error) {
console.error('Error testing Mastodon client:', error);
}
}
// Run the test
testMastodonClient().catch(error => {
console.error('Unhandled error:', error);
});