-
Notifications
You must be signed in to change notification settings - Fork 23
Expand file tree
/
Copy pathtest-commonjs.js
More file actions
29 lines (24 loc) · 845 Bytes
/
test-commonjs.js
File metadata and controls
29 lines (24 loc) · 845 Bytes
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
/**
* Test CommonJS import method
*/
const { getFonts, getFonts2 } = require('./index.js');
async function testCommonJS() {
console.log('=== CommonJS Test ===');
try {
console.log('Testing getFonts...');
const fonts = await getFonts();
console.log(`✓ getFonts succeeded, got ${fonts.length} fonts`);
console.log('First 5 fonts:', fonts.slice(0, 5));
} catch (error) {
console.error('✗ getFonts failed:', error.message);
}
try {
console.log('\nTesting getFonts2...');
const detailedFonts = await getFonts2();
console.log(`✓ getFonts2 succeeded, got ${detailedFonts.length} detailed font info`);
console.log('First 3 detailed fonts:', detailedFonts.slice(0, 3));
} catch (error) {
console.error('✗ getFonts2 failed:', error.message);
}
}
testCommonJS().catch(console.error);