import { followersRegExp , fromRegExp , nearRegExp , sinceRegExp , untilRegExp , filterRegExp , hashtagRegExp , mentionRegExp } from './reg-exp' ; describe ( 'reg-exp' , ( ) => { it ( 'should return true when input is (from:fossasia)' , ( ) => { const str = 'from:fossasia' ; const match = fromRegExp . exec ( str ) ; expect ( match [ 0 ] ) . toEqual ( 'from:fossasia' ) ; expect ( match [ 1 ] ) . toEqual ( 'fossasia' ) ; expect ( match ) . toBeTruthy ( ) ; } ) ; it ( 'should return false when input is (fossasia)' , ( ) => { const str = 'fossasia' ; const match = fromRegExp . exec ( str ) ; expect ( match ) . toBeNull ( ) ; expect ( match ) . toBeFalsy ( ) ; } ) ; it ( 'should return true when input is (followers:fossasia)' , ( ) => { const str = 'followers:fossasia' ; const match = followersRegExp . exec ( str ) ; expect ( match [ 0 ] ) . toEqual ( 'followers:fossasia' ) ; expect ( match [ 1 ] ) . toEqual ( 'fossasia' ) ; expect ( match ) . toBeTruthy ( ) ; } ) ; it ( 'should return false when input is (near:fossasia)' , ( ) => { const str = 'near:fossasia' ; const match = followersRegExp . exec ( str ) ; expect ( match ) . toBeNull ( ) ; expect ( match ) . toBeFalsy ( ) ; } ) ; it ( 'should return true when input is (near:Delhi)' , ( ) => { const str = 'near:Delhi' ; const match = nearRegExp . exec ( str ) ; expect ( match [ 0 ] ) . toEqual ( 'near:Delhi' ) ; expect ( match [ 1 ] ) . toEqual ( 'Delhi' ) ; expect ( match ) . toBeTruthy ( ) ; } ) ; it ( 'should return false when input is (from:Delhi)' , ( ) => { const str = 'from:Delhi' ; const match = nearRegExp . exec ( str ) ; expect ( match ) . toBeNull ( ) ; expect ( match ) . toBeFalsy ( ) ; } ) ; it ( 'should return true when input is (since:19:06:2018)' , ( ) => { const str = 'since:19:06:2018' ; const match = sinceRegExp . exec ( str ) ; expect ( match [ 0 ] ) . toEqual ( 'since:19:06:2018' ) ; expect ( match [ 1 ] ) . toEqual ( '19:06:2018' ) ; expect ( match ) . toBeTruthy ( ) ; } ) ; it ( 'should return false when input is (from:19:06:2018)' , ( ) => { const str = 'from:19:06:2018' ; const match = sinceRegExp . exec ( str ) ; expect ( match ) . toBeNull ( ) ; expect ( match ) . toBeFalsy ( ) ; } ) ; it ( 'should return true when input is (until:19:06:2018)' , ( ) => { const str = 'until:19:06:2018' ; const match = untilRegExp . exec ( str ) ; expect ( match [ 0 ] ) . toEqual ( 'until:19:06:2018' ) ; expect ( match [ 1 ] ) . toEqual ( '19:06:2018' ) ; expect ( match ) . toBeTruthy ( ) ; } ) ; it ( 'should return false when input is (near:19:06:2018)' , ( ) => { const str = 'near:19:06:2018' ; const match = untilRegExp . exec ( str ) ; expect ( match ) . toBeNull ( ) ; expect ( match ) . toBeFalsy ( ) ; } ) ; it ( 'should return true when input is (filter:image)' , ( ) => { const str = 'filter:image' ; const match = filterRegExp . exec ( str ) ; expect ( match [ 0 ] ) . toEqual ( 'filter:image' ) ; expect ( match [ 1 ] ) . toEqual ( 'image' ) ; expect ( match ) . toBeTruthy ( ) ; } ) ; it ( 'should return true when input is (filter:video)' , ( ) => { const str = 'filter:video' ; const match = filterRegExp . exec ( str ) ; expect ( match [ 0 ] ) . toEqual ( 'filter:video' ) ; expect ( match [ 1 ] ) . toEqual ( 'video' ) ; expect ( match ) . toBeTruthy ( ) ; } ) ; it ( 'should return false when input is (image:filter)' , ( ) => { const str = 'image:filter' ; const match = filterRegExp . exec ( str ) ; expect ( match ) . toBeNull ( ) ; expect ( match ) . toBeFalsy ( ) ; } ) ; it ( 'should return true when input is (#FOSSASIA)' , ( ) => { const str = '#FOSSASIA' ; const match = hashtagRegExp . exec ( str ) ; expect ( match [ 0 ] ) . toEqual ( '#FOSSASIA' ) ; expect ( match [ 1 ] ) . toEqual ( 'FOSSASIA' ) ; expect ( match ) . toBeTruthy ( ) ; } ) ; it ( 'should return false when input is (near:19:06:2018)' , ( ) => { const str = 'near:19:06:2018' ; const match = hashtagRegExp . exec ( str ) ; expect ( match ) . toBeNull ( ) ; expect ( match ) . toBeFalsy ( ) ; } ) ; it ( 'should return true when input is (@FOSSASIA)' , ( ) => { const str = '@FOSSASIA' ; const match = mentionRegExp . exec ( str ) ; expect ( match [ 0 ] ) . toEqual ( '@FOSSASIA' ) ; expect ( match [ 1 ] ) . toEqual ( 'FOSSASIA' ) ; expect ( match ) . toBeTruthy ( ) ; } ) ; it ( 'should return false when input is (from:FOSSASIA)' , ( ) => { const str = 'from:FOSSASIA' ; const match = mentionRegExp . exec ( str ) ; expect ( match ) . toBeNull ( ) ; expect ( match ) . toBeFalsy ( ) ; } ) ; } ) ;