-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest-scraper.js
More file actions
52 lines (41 loc) · 1.41 KB
/
Copy pathtest-scraper.js
File metadata and controls
52 lines (41 loc) · 1.41 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
48
49
50
51
52
/**
* Test scraper without interactive prompts
*/
const CompetitorScraper = require('./src/scraper');
const ReportFormatter = require('./src/formatter');
async function test() {
console.log('Testing Competitor Intel Toolkit scraper...\n');
const scraper = new CompetitorScraper();
// Test with a simple, reliable site
const testUrls = [
'https://www.example.com',
];
console.log(`Scraping ${testUrls.length} test URL(s)...\n`);
const results = await scraper.analyzeMultiple(testUrls);
results.forEach(result => {
console.log(`\n--- ${result.url} ---`);
if (result.success) {
console.log('✓ Success');
console.log('Company:', result.company);
console.log('Messaging:', result.messaging);
console.log('Pricing plans found:', result.pricing.plans.length);
console.log('Prices found:', result.pricing.prices.length);
console.log('Features found:', result.features.length);
} else {
console.log('✗ Failed:', result.error);
}
});
// Test formatter
const reportData = {
yourCompany: 'Test Company',
yourFeatures: ['feature 1', 'feature 2'],
competitors: results,
aiAnalysis: {},
timestamp: new Date().toISOString(),
};
const formatter = new ReportFormatter(reportData);
console.log('\n\n=== FORMATTED REPORT ===\n');
console.log(formatter.formatCLI());
console.log('\n✅ Test complete!');
}
test().catch(console.error);