-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtest-api.js
More file actions
47 lines (41 loc) · 1.86 KB
/
test-api.js
File metadata and controls
47 lines (41 loc) · 1.86 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
async function testSearch() {
try {
console.log('Testing search for "Llanowarelfen" (German)...');
const response = await fetch('http://localhost:3000/api/search', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ query: 'Llanowarelfen', limit: 10 })
});
const data = await response.json();
if (data.length > 0) {
const firstResult = data[0];
console.log('First result:');
console.log('- Name:', firstResult.name);
console.log('- Lang:', firstResult.lang);
console.log('- Set:', firstResult.set);
console.log('- ID:', firstResult.id);
console.log('- Oracle ID:', firstResult.fullCard?.oracle_id);
console.log('- All printings count:', firstResult.allPrintings?.length || 0);
if (firstResult.allPrintings?.length > 0) {
console.log('\nAll printings:');
firstResult.allPrintings.forEach((printing, index) => {
if (index < 10) { // Show first 10 only
console.log(` ${index + 1}. ${printing.name} - ${printing.set_name} (${printing.set.toUpperCase()}) #${printing.collector_number} - Lang: ${printing.lang}`);
}
});
// Check how many German printings there are
const germanPrintings = firstResult.allPrintings.filter(p => p.lang === 'de');
console.log(`\nGerman printings: ${germanPrintings.length} out of ${firstResult.allPrintings.length} total`);
if (germanPrintings.length > 0) {
console.log('German printings:');
germanPrintings.forEach((printing, index) => {
console.log(` ${index + 1}. ${printing.set_name} (${printing.set.toUpperCase()}) #${printing.collector_number}`);
});
}
}
}
} catch (error) {
console.error('Error testing search:', error.message);
}
}
testSearch();