import { describe, it, expect, vi } from 'vitest'; import { render, screen } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; import { DeckyGridEmpty } from './DeckyGridEmpty'; describe('DeckyGridEmpty', () => { it('shows the fleet-empty copy when fleetEmpty is true', () => { render( {}} />, ); expect(screen.getByText('NO DECOYS DEPLOYED IN THIS SECTOR')).toBeInTheDocument(); }); it('shows the filtered-empty copy when fleetEmpty is false', () => { render( {}} />, ); expect(screen.getByText('NO DECOYS MATCH CURRENT FILTER')).toBeInTheDocument(); }); it('only renders the DEPLOY shortcut for admins on a truly empty fleet', () => { const { rerender } = render( {}} />, ); expect(screen.queryByText(/DEPLOY DECKIES/)).not.toBeInTheDocument(); rerender( {}} />, ); expect(screen.queryByText(/DEPLOY DECKIES/)).not.toBeInTheDocument(); const onDeploy = vi.fn(); rerender( , ); const user = userEvent.setup(); return user.click(screen.getByText(/DEPLOY DECKIES/)).then(() => { expect(onDeploy).toHaveBeenCalled(); }); }); });