@@ -407,7 +407,7 @@ describe('convert', () => {
407407 } ) ;
408408 } ) ;
409409
410- describe ( 'utf8ToUni8 ' , ( ) => {
410+ describe ( 'utf8ToUint8 ' , ( ) => {
411411 it ( 'should convert numeric string to Uint8Array' , ( ) => {
412412 const actual = '123456789' ;
413413 // Act:
@@ -428,6 +428,16 @@ describe('convert', () => {
428428 expect ( uint . length ) . to . be . equal ( actual . length ) ;
429429 expect ( convert . uint8ToHex ( uint ) ) . to . be . equal ( '74657374' ) ;
430430 } ) ;
431+
432+ it ( 'should convert non-ascii utf8 string to Uint8Array' , ( ) => {
433+ const actual = '存在' ;
434+ // Act:
435+ const uint = convert . utf8ToUint8 ( actual ) ;
436+
437+ // Assert:
438+ expect ( uint . length ) . to . be . equal ( 6 ) ;
439+ expect ( convert . uint8ToHex ( uint ) ) . to . be . equal ( 'E5AD98E59CA8' ) ;
440+ } ) ;
431441 } ) ;
432442
433443 describe ( 'uint8ToUtf8' , ( ) => {
@@ -450,6 +460,16 @@ describe('convert', () => {
450460 // Assert:
451461 expect ( result ) . to . be . equal ( expected ) ;
452462 } ) ;
463+
464+ it ( 'should convert Uint8Array to non-ascii utf8 string ' , ( ) => {
465+ const expected = '存在' ;
466+ const actual = convert . utf8ToUint8 ( expected ) ;
467+ // Act:
468+ const result = convert . uint8ToUtf8 ( actual ) ;
469+
470+ // Assert:
471+ expect ( result ) . to . be . equal ( expected ) ;
472+ } ) ;
453473 } ) ;
454474
455475 describe ( 'numberToUint8Array' , ( ) => {
0 commit comments