import { test, expect } from '../fixtures'; test.describe('GET /auth/profile/agent', () => { test('returns agent profile or null for authenticated user', async ({ authedRequest }) => { const res = await authedRequest.get('auth/profile/agent'); expect(res.status()).toBe(200); const text = await res.text(); // Regular user may not have an agent — null returns empty body if (text) { const body = JSON.parse(text); expect(body).toBeTruthy(); } // Empty body (null) is also valid }); test('rejects unauthenticated requests', async ({ request }) => { const res = await request.get('auth/profile/agent'); expect(res.status()).toBe(401); }); test('rejects requests with invalid token', async ({ request }) => { const res = await request.get('auth/profile/agent', { headers: { Authorization: 'Bearer invalid.jwt.token' }, }); expect(res.status()).toBe(401); }); });