const axios = require('axios');

const API_URL = 'http://localhost:5001/api';

async function checkAuthMe() {
    try {
        // Login as 'janedoe' (user)
        const res = await axios.post(`${API_URL}/auth/login`, {
            email: 'jane@example.com',
            password: 'password123'
        });
        const token = res.data.token;
        console.log('Login successful.');

        // Get Me
        const meRes = await axios.get(`${API_URL}/auth/me`, {
            headers: { Authorization: `Bearer ${token}` }
        });

        console.log('User Data from /auth/me:', meRes.data);
        if (meRes.data.image) {
            console.log('SUCCESS: /auth/me returns "image" field.');
        } else {
            console.log('WARNING: /auth/me does not return "image" field.');
        }

    } catch (err) {
        console.error('Check failed:', err.response ? err.response.data : err.message);
    }
}

checkAuthMe();
