import { afterEach, describe, expect, it, vi } from 'vitest' import { GET_DISCOUNT_MANAGEMENT_BOOTSTRAP } from '@/services/discountCodes' const get = vi.fn() vi.mock('@/config/axios', () => ({ default: { get: (...args: unknown[]) => get(...args) } })) describe('discount management bootstrap', () => { afterEach(() => vi.clearAllMocks()) it('loads codes, report and redemptions through one HTTP request', async () => { get.mockResolvedValue({ data: { success: true, data: { codes: { items: [] }, report: { totalCodes: 0 }, redemptions: { items: [] } }, }, }) const result = await GET_DISCOUNT_MANAGEMENT_BOOTSTRAP('event-1') expect(result.ok).toBe(true) expect(get).toHaveBeenCalledOnce() expect(get).toHaveBeenCalledWith('events/event-1/discount-codes/management-bootstrap') }) })