import { describe, expect, it, vi } from 'vitest'

vi.mock('../../lib/prisma', () => ({ prisma: { employee: { findUnique: vi.fn() }, renter: { findUnique: vi.fn() } } }))
vi.mock('../../lib/redis', () => ({
  redis: { on: vi.fn(), get: vi.fn(), set: vi.fn(), del: vi.fn(), quit: vi.fn() },
}))

import request from 'supertest'
import { createApp } from '../../app'

const app = createApp()

describe('operations auth-boundary e2e smoke', () => {
  it('keeps operational company routes behind auth while leaving the health endpoint public', async () => {
    const health = await request(app).get('/health')
    expect(health.status).toBe(200)

    for (const path of ['/api/v1/offers', '/api/v1/team/stats', '/api/v1/notifications/company', '/api/v1/notifications/unread-count']) {
      const res = await request(app).get(path)
      expect(res.status).toBe(401)
    }
  })
})
