forked from Manuel1234477/Stellar-Micro-Donation-API
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest-analytics-fee.js
More file actions
34 lines (29 loc) · 1.16 KB
/
test-analytics-fee.js
File metadata and controls
34 lines (29 loc) · 1.16 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
/**
* Test script for analytics fee calculation
* Run with: node test-analytics-fee.js
*/
const { calculateAnalyticsFee } = require('./src/utils/feeCalculator');
console.log('Testing Analytics Fee Calculator\n');
console.log('='.repeat(50));
// Test cases
const testCases = [
{ amount: 50, description: 'Small donation' },
{ amount: 100, description: 'Medium donation' },
{ amount: 200, description: 'Large donation' },
{ amount: 0.25, description: 'Micro donation (below minimum)' },
{ amount: 1000, description: 'Very large donation' }
];
testCases.forEach(test => {
try {
const result = calculateAnalyticsFee(test.amount);
console.log(`\n${test.description}:`);
console.log(` Original Amount: $${result.originalAmount}`);
console.log(` Analytics Fee: $${result.fee} (${result.feePercentage * 100}%)`);
console.log(` Total with Fee: $${result.totalWithFee}`);
} catch (error) {
console.error(`Error with ${test.description}:`, error.message);
}
});
console.log('\n' + '='.repeat(50));
console.log('\nNote: Fees are calculated but NOT deducted on-chain');
console.log('They are stored in the database for analytics purposes only.\n');