forked from Vesting-Vault/backend
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest-endpoint.js
More file actions
42 lines (34 loc) · 1.07 KB
/
test-endpoint.js
File metadata and controls
42 lines (34 loc) · 1.07 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
// Test script for portfolio endpoint
const http = require('http');
const testAddress = '0x1234567890abcdef1234567890abcdef12345678';
const options = {
hostname: 'localhost',
port: 3000,
path: `/api/user/${testAddress}/portfolio`,
method: 'GET',
headers: {
'Content-Type': 'application/json'
}
};
const req = http.request(options, (res) => {
let data = '';
res.on('data', (chunk) => {
data += chunk;
});
res.on('end', () => {
console.log('✅ Response Status:', res.statusCode);
console.log('✅ Response Data:');
console.log(JSON.stringify(JSON.parse(data), null, 2));
// Verify acceptance criteria
const response = JSON.parse(data);
if (response.total_locked === 100 && response.total_claimable === 20) {
console.log('🎉 SUCCESS: Acceptance criteria met!');
} else {
console.log('❌ FAILED: Acceptance criteria not met');
}
});
});
req.on('error', (e) => {
console.error('❌ Request Error:', e.message);
});
req.end();