#!/usr/bin/env node
import { getWorkbookLinks, getWorkbookContent } from '../src/tools/workbook-tools.js';
async function testWorkbookTools() {
console.log('๐ Testing getWorkbookLinks...');
try {
// Test getWorkbookLinks with current May 2025 issue
const links = await getWorkbookLinks('mwb', 'E', '20250500', 'RTF');
console.log('โ
getWorkbookLinks successful!');
console.log(`๐ Publication: ${links.pubName}`);
console.log(`๐
Date: ${links.formattedDate}`);
console.log(`๐ Language: ${links.language}`);
console.log(`๐ Available weeks (${links.weekFiles.length}):`);
links.weekFiles.forEach((week, index) => {
console.log(` ${index + 1}. ${week.title}`);
console.log(` URL: ${week.url}`);
console.log(` Size: ${(week.filesize / 1024).toFixed(1)} KB`);
console.log('');
});
if (links.weekFiles.length > 0) {
console.log('\n๐ Testing getWorkbookContent with first week...');
const firstWeek = links.weekFiles[0];
const content = await getWorkbookContent(firstWeek.url);
console.log('โ
getWorkbookContent 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('โ Test failed:', error.message);
}
}
testWorkbookTools();