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

vi.mock('../../lib/prisma', () => ({ prisma: {} }))
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('employee and carplace public boundary smoke', () => {
  it('rejects malformed employee login payloads without leaking internals', async () => {
    const res = await request(app).post('/api/v1/auth/employee/login').send({ email: 'not-an-email', password: 'x' })

    expect(res.status).toBe(400)
    expect(JSON.stringify(res.body)).not.toContain('stack')
  })

  it('rejects invalid public review payloads without executing private infrastructure', async () => {
    const res = await request(app).post('/api/v1/carplace/review/token_123').send({ overallRating: 0 })

    expect(res.status).toBe(400)
    expect(JSON.stringify(res.body)).not.toContain('Prisma')
  })
})
