| 102 | } |
| 103 | |
| 104 | async testSpecificArticle(issueNumber = 1) { |
| 105 | console.log(`\n📄 Testing get article #${issueNumber}`); |
| 106 | |
| 107 | return new Promise((resolve, reject) => { |
| 108 | this.db.get( |
| 109 | 'SELECT * FROM issues WHERE number = ?', |
| 110 | [issueNumber], |
| 111 | (err, row) => { |
| 112 | if (err) { |
| 113 | console.error('❌ Database query failed:', err.message); |
| 114 | reject(err); |
| 115 | return; |
| 116 | } |
| 117 | |
| 118 | if (!row) { |
| 119 | console.error(`❌ Article #${issueNumber} not found`); |
| 120 | reject(new Error('Article not found')); |
| 121 | return; |
| 122 | } |
| 123 | |
| 124 | console.log('✅ Article found:'); |
| 125 | console.log(` Title: ${row.title}`); |
| 126 | console.log(` Created: ${row.created_at}`); |
| 127 | console.log(` Updated: ${row.updated_at}`); |
| 128 | console.log(` Body length: ${row.body?.length || 0} chars`); |
| 129 | |
| 130 | resolve(row); |
| 131 | } |
| 132 | ); |
| 133 | }); |
| 134 | } |
| 135 | |
| 136 | async testCategories() { |
| 137 | console.log('\n🏷️ Testing categories listing'); |