#!/usr/bin/env node
import { getWatchtowerLinks, getWatchtowerContent } from '../src/tools/watchtower-tools.js';
async function testWatchtowerTools() {
console.log('π Testing getWatchtowerLinks...');
try {
// Test getWatchtowerLinks with current issue (auto-detected)
const links = await getWatchtowerLinks();
console.log('β
getWatchtowerLinks successful!');
console.log(`π° Publication: ${links.pubName}`);
console.log(`π
Date: ${links.formattedDate}`);
console.log(`π Language: ${links.language}`);
console.log(`π Available articles (${links.articles.length}):`);
links.articles.forEach((article, index) => {
const sizeKB = (article.filesize / 1024).toFixed(1);
console.log(` ${index + 1}. ${article.title}`);
console.log(` URL: ${article.url}`);
console.log(` Size: ${sizeKB} KB\n`);
});
// Test getWatchtowerContent with first article
if (links.articles.length > 0) {
console.log('π Testing getWatchtowerContent with first article...');
const firstArticle = links.articles[0];
const content = await getWatchtowerContent(firstArticle.url);
console.log('β
getWatchtowerContent successful!');
console.log(`π Content size: ${(content.size / 1024).toFixed(1)} KB`);
console.log(`π― Content type: ${content.contentType}`);
console.log(`π First 200 characters:`);
console.log(content.content.substring(0, 200) + '...');
}
} catch (error) {
console.error('β Error:', error.message);
}
}
testWatchtowerTools();