-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest-profile-update.js
More file actions
51 lines (46 loc) · 1.46 KB
/
test-profile-update.js
File metadata and controls
51 lines (46 loc) · 1.46 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
const axios = require('axios');
async function testProfileUpdate() {
try {
// First, let's register a test user to get a token
const registerResponse = await axios.post('http://localhost:3000/api/auth/register', {
email: 'testprofile@example.com',
password: 'Test123!',
name: 'Test User',
firstName: 'Test',
lastName: 'User',
dateOfBirth: '1990-01-01',
gender: 'male',
city: 'Test City',
state: 'Test State',
country: 'Test Country',
zipCode: '12345',
location: {
type: 'Point',
coordinates: [-122.4194, 37.7749]
}
});
console.log('✅ Registration successful');
const token = registerResponse.data.data.token;
// Now try to update profile
console.log('🔄 Updating profile...');
const profileResponse = await axios.put('http://localhost:3000/api/users/profile', {
profilePicture: 'data:image/png;base64,testimage',
firstName: 'Updated',
lastName: 'User',
age: 30,
bio: 'This is a test bio',
interests: ['Hiking', 'Reading'],
relationshipGoals: ['Long-term relationship']
}, {
headers: {
'Authorization': `Bearer ${token}`,
'Content-Type': 'application/json'
}
});
console.log('✅ Profile update successful');
console.log('Response:', profileResponse.data);
} catch (error) {
console.error('❌ Error:', error.response?.data || error.message);
}
}
testProfileUpdate();