import { fireEvent, render } from '@testing-library/react-native'; import { describe, expect, it, vi } from 'vitest'; import { PinInput } from './PinInput'; describe('', () => { it('appends digits to the underlying value and stops at length', () => { const onChange = vi.fn(); const { getByTestId } = render( , ); fireEvent.changeText(getByTestId('pin-input'), '1234567890'); expect(onChange).toHaveBeenCalledWith('123456'); }); it('strips non-digits', () => { const onChange = vi.fn(); const { getByTestId } = render( , ); fireEvent.changeText(getByTestId('pin-input'), '1a2b3c'); expect(onChange).toHaveBeenCalledWith('123'); }); it('renders one bullet per filled slot', () => { const { getAllByText } = render( {}} length={6} ariaLabel="PIN" />, ); expect(getAllByText('•').length).toBe(3); }); });