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('subscription and team public boundary smoke', () => {
  it('rejects malformed protected subscription checkout without leaking internals', async () => {
    const res = await request(app).post('/api/v1/subscriptions/checkout').send({ provider: 'PAYPAL' })

    expect([400, 401]).toContain(res.status)
    expect(JSON.stringify(res.body)).not.toContain('stack')
  })
})
