-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtest_final_google.js
More file actions
43 lines (35 loc) · 1.44 KB
/
test_final_google.js
File metadata and controls
43 lines (35 loc) · 1.44 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
const axios = require('axios');
async function probarEndpointsGoogle() {
console.log('🧪 Probando endpoints de Google OAuth\n');
try {
// Probar endpoint de prueba
console.log('1. 🔬 Probando endpoint de prueba...');
const testResponse = await axios.post('http://localhost:4000/usuarios/auth/google/test', {
googleToken: 'token_de_prueba_123'
});
console.log('✅ Endpoint de prueba funcionando:');
console.log(' ', testResponse.data);
} catch (error) {
console.log('❌ Error en endpoint de prueba:', error.response?.data);
}
try {
// Probar endpoint principal (debe fallar con token inválido)
console.log('\n2. 🔐 Probando endpoint principal...');
await axios.post('http://localhost:4000/usuarios/auth/google', {
googleToken: 'token_de_prueba_123'
});
} catch (error) {
console.log('✅ Endpoint principal funcionando (error esperado):');
console.log(' Status:', error.response?.status);
console.log(' Mensaje:', error.response?.data?.message);
console.log(' Error:', error.response?.data?.error);
}
console.log('\n🎯 Resumen:');
console.log(' ✅ Servidor recibe requests correctamente');
console.log(' ✅ Body parsing funciona perfectamente');
console.log(' ✅ Validaciones están activas');
console.log(' ✅ Respuestas son informativas');
}
if (require.main === module) {
probarEndpointsGoogle().catch(console.error);
}