github.com/oinume/lekcije@v0.0.0-20231017100347-5b4c5eb6ab24/frontend/src/components/Select.test.tsx (about) 1 import React from 'react'; 2 import {render, screen} from '@testing-library/react'; 3 import '@testing-library/jest-dom'; 4 import {Select} from './Select'; 5 6 test('<Select> initial state', () => { 7 const options = [ 8 {value: 'japan', label: 'Japan'}, 9 {value: 'china', label: 'China'}, 10 ]; 11 render( 12 <Select 13 name="country" 14 value="" 15 className="" 16 options={options} 17 onChange={(_: React.ChangeEvent<HTMLSelectElement>) => { 18 // Nop 19 }} 20 />, 21 ); 22 23 expect(screen.getByDisplayValue('Japan')).toBeInTheDocument(); 24 // TODO: write more assertions 25 });