49 lines
1.4 KiB
TypeScript
49 lines
1.4 KiB
TypeScript
|
|
import { calculateImportanceScore } from '../src/services/importance';
|
|
|
|
async function run() {
|
|
console.log('Testing Importance Score Calculation');
|
|
|
|
const testCases = [
|
|
{
|
|
name: 'Case 1: 100% change, short content, main content',
|
|
factors: {
|
|
changePercentage: 100,
|
|
keywordMatches: 0,
|
|
isMainContent: true,
|
|
isRecurringPattern: false,
|
|
contentLength: 200
|
|
}
|
|
},
|
|
{
|
|
name: 'Case 2: 100% change, short content, NOT main content',
|
|
factors: {
|
|
changePercentage: 100,
|
|
keywordMatches: 0,
|
|
isMainContent: false,
|
|
isRecurringPattern: false,
|
|
contentLength: 200
|
|
}
|
|
},
|
|
{
|
|
name: 'Case 3: 0.1% change, short content',
|
|
factors: {
|
|
changePercentage: 0.1,
|
|
keywordMatches: 0,
|
|
isMainContent: true,
|
|
isRecurringPattern: false,
|
|
contentLength: 50
|
|
}
|
|
}
|
|
];
|
|
|
|
for (const test of testCases) {
|
|
const score = calculateImportanceScore(test.factors);
|
|
console.log(`\n${test.name}:`);
|
|
console.log(`Factors:`, test.factors);
|
|
console.log(`Score: ${score}`);
|
|
}
|
|
}
|
|
|
|
run();
|