import * as SUT from '../index' ; import { defaultSelectOptions } from '../../select-options-in-handle' ; import { ElementHandle } from 'playwright' ; describe ( 'select options by value in handle' , ( ) : void => { beforeEach ( ( ) : void => { } ) ; test ( 'should throw an error when selector is undefined' , async ( ) : Promise < void > => { const handle = undefined ; const expectedError = new Error ( "Cannot select options 'foo,bar' because no browser has been launched" ) ; await SUT . selectOptionsByValueInHandle ( handle , 'foobar' , [ 'foo' , 'bar' ] , undefined , defaultSelectOptions ) . catch ( ( error ) : void => expect ( error ) . toMatchObject ( expectedError ) ) ; } ) ; test ( 'should throw an error when selector is null' , async ( ) : Promise < void > => { const handle = null ; const expectedError = new Error ( "Cannot select options 'foo,bar' because no browser has been launched" ) ; await SUT . selectOptionsByValueInHandle ( handle , 'foobar' , [ 'foo' , 'bar' ] , undefined , defaultSelectOptions ) . catch ( ( error ) : void => expect ( error ) . toMatchObject ( expectedError ) ) ; } ) ; } ) ;