test-image-generation.jsā¢1.68 kB
#!/usr/bin/env node
/**
* Test script to show you how to get actual images from the Dad Joke Visualizer
*/
import { generateDadJoke } from './dist/tools/jokeGenerator.js';
import { generateImage } from './dist/tools/imageGenerator.js';
async function testImageGeneration() {
console.log('š Testing Actual Image Generation...\n');
try {
// Generate a real dad joke
console.log('1ļøā£ Generating Dad Joke...');
const joke = await generateDadJoke('programming', 'PG-13');
console.log(`ā
Joke: "${joke}"\n`);
// Generate the actual image
console.log('2ļøā£ Generating Image with Multi-Tier Fallback...');
const imageUrl = await generateImage(joke, 'programming', 'PG-13');
console.log(`ā
Image URL: ${imageUrl}\n`);
// Show you how to access the image
console.log('šÆ HOW TO VIEW YOUR ACTUAL IMAGE:');
console.log('ā'.repeat(50));
if (imageUrl.startsWith('data:')) {
console.log('š This is an SVG data URL - copy the entire URL below and paste into your browser:');
console.log(`š ${imageUrl}`);
} else {
console.log('š This is an external image URL - click the link below to view:');
console.log(`š ${imageUrl}`);
}
console.log('\nš” ALTERNATIVE METHODS:');
console.log('1. Copy the URL above and paste into browser address bar');
console.log('2. Right-click and "Save Image As" to download');
console.log('3. Use the web interface at http://localhost:3000');
console.log('4. Check individual joke pages at /joke/[id]');
} catch (error) {
console.error('ā Error:', error.message);
}
}
testImageGeneration();