import Mode from '../../mode' ; import { Segment } from '../segment' ; import { encode } from '.' ; describe ( 'encoder > byte' , ( ) => { it ( 'encodes the input and include Mode.BYTE' , ( ) => { const input = 'http://a.b' ; const result = [ '01101000' , '01110100' , '01110100' , '01110000' , '00111010' , '00101111' , '00101111' , '01100001' , '00101110' , '01100010' , ] ; const segment = { mode : Mode . BYTE , dataSize : 10 , data : result . join ( '' ) } ; expect ( encode ( input ) ) . toEqual ( segment ) ; } ) ; it ( 'works with emojis (surrogate chars)' , ( ) => { const input = '💄👀💥' ; const result = [ '11110000100111111001001010000100' , '11110000100111111001000110000000' , '11110000100111111001001010100101' , ] ; const segment = { mode : Mode . BYTE , dataSize : 12 , data : result . join ( '' ) } ; expect ( encode ( input ) ) . toEqual ( segment ) ; } ) ; } ) ;