import 'mocha' ; import * as assert from 'assert' ; import StringUtils from './../../../core/common/StringUtils' ; import CharacterSetECI from './../../../core/common/CharacterSetECI' ; describe ( "StringUtilsTestCase" , ( ) => { it ( "testShortShiftJIS_1" , ( ) => { doTest ( Uint8Array . from ( [ 0x8b , 0xe0 , 0x8b , 0x9b ] ) , CharacterSetECI . SJIS . getName ( ) ) ; } ) ; it ( "testShortISO88591_1" , ( ) => { doTest ( Uint8Array . from ( [ 0x62 , 0xe5 , 0x64 ] ) , CharacterSetECI . ISO8859_1 . getName ( ) ) ; } ) ; it ( "testMixedShiftJIS_1" , ( ) => { doTest ( Uint8Array . from ( [ 0x48 , 0x65 , 0x6c , 0x6c , 0x6f , 0x20 , 0x8b , 0xe0 , 0x21 ] ) , "SJIS" ) ; } ) ; function doTest ( bytes , charsetName ) { const guessedName = StringUtils . guessEncoding ( bytes , null ) ; assert . strictEqual ( guessedName , charsetName ) ; } } ) ;