import { Selector } from './selector' ; import { mobile$ , mobile$$ } from './select' ; import { UNSUPPORTED_PLATFORM_ERROR } from '../internal/utils' ; describe ( 'Select' , function ( ) { global . browser = { isAndroid : false , isIOS : false , } ; const selectorNullError = 'Selector which has been passed in is: null' ; const selectorUndefinedError = 'Selector which has been passed in is: undefined' ; const selector = Selector . enabled ( ) ; const mock$ = jest . fn ( ) ; const mock$$ = jest . fn ( ) ; global . $ = mock$ ; global . $$ = mock$$ ; beforeEach ( ( ) => { mock$ . mockReset ( ) ; mock$$ . mockReset ( ) ; } ) ; it ( 'should throw an error when calling mobile$() with undefined or null' , function ( ) { expect ( ( ) => mobile$ ( null ) ) . toThrowError ( selectorNullError ) ; expect ( ( ) => mobile$ ( undefined ) ) . toThrowError ( selectorUndefinedError ) ; } ) ; it ( 'should throw an error when calling mobile$$() with undefined or null' , function ( ) { expect ( ( ) => mobile$$ ( null ) ) . toThrowError ( selectorNullError ) ; expect ( ( ) => mobile$$ ( undefined ) ) . toThrowError ( selectorUndefinedError ) ; } ) ; describe ( 'Unsupported Platform' , function ( ) { it ( 'should throw an error when trying to use mobile$() on a platform other than Android or iOS' , function ( ) { expect ( ( ) => mobile$ ( selector ) ) . toThrowError ( UNSUPPORTED_PLATFORM_ERROR ) ; } ) ; it ( 'should throw an error when trying to use mobile$$() on a platform other than Android or iOS' , function ( ) { expect ( ( ) => mobile$$ ( selector ) ) . toThrowError ( UNSUPPORTED_PLATFORM_ERROR ) ; } ) ; } ) ; } ) ;