import { fireEvent, render, screen } from '@testing-library/react'; import { describe, expect, it, vi } from 'vitest'; import { QuotaBlockedView } from './QuotaBlockedView'; import { en } from '../i18n/en'; describe('QuotaBlockedView shopper-safe quota copy', () => { it('uses the neutral default without exposing quota or billing', () => { render( ); expect(screen.getByText('Virtual try-on will be back soon')).toBeTruthy(); expect(screen.getByText(/refreshing the virtual fitting room/i)).toBeTruthy(); expect(screen.queryByText(/quota|billing|store owner/i)).toBeNull(); expect(screen.getByRole('button').textContent).toBe('Continue shopping'); }); it('uses merchant copy and follows its same-site CTA', () => { const assign = vi.fn(); vi.stubGlobal('location', { assign }); render( ); expect(screen.getByText('Our fitting room is having a glow-up')).toBeTruthy(); fireEvent.click(screen.getByRole('button', { name: 'See new arrivals' })); expect(assign).toHaveBeenCalledWith('https://shop.example/new'); vi.unstubAllGlobals(); }); });