1+ import { wcswidth , wcwidth } from 'simple-wcswidth' ;
2+
3+ describe ( 'simple-wcswidth TypeScript exports' , ( ) => {
4+ test ( 'should export wcswidth function with correct type' , ( ) => {
5+ // Check that wcswidth is a function
6+ expect ( typeof wcswidth ) . toBe ( 'function' ) ;
7+
8+ // Test functionality with TypeScript types
9+ const width1 : number = wcswidth ( 'hello' ) ;
10+ expect ( width1 ) . toBe ( 5 ) ;
11+
12+ const width2 : number = wcswidth ( '你好' ) ;
13+ expect ( width2 ) . toBe ( 4 ) ;
14+
15+ const width3 : number = wcswidth ( 'こんにちは' ) ;
16+ expect ( width3 ) . toBe ( 10 ) ;
17+
18+ const width4 : number = wcswidth ( '안녕하세요' ) ;
19+ expect ( width4 ) . toBe ( 10 ) ;
20+ } ) ;
21+
22+ test ( 'should export wcwidth function with correct type' , ( ) => {
23+ // Check that wcwidth is a function
24+ expect ( typeof wcwidth ) . toBe ( 'function' ) ;
25+
26+ // Test functionality with TypeScript types
27+ const width1 : number = wcwidth ( 'a' . charCodeAt ( 0 ) ) ;
28+ expect ( width1 ) . toBe ( 1 ) ;
29+
30+ const width2 : number = wcwidth ( '你' . charCodeAt ( 0 ) ) ;
31+ expect ( width2 ) . toBe ( 2 ) ;
32+
33+ const width3 : number = wcwidth ( 'こ' . charCodeAt ( 0 ) ) ;
34+ expect ( width3 ) . toBe ( 2 ) ;
35+
36+ const width4 : number = wcwidth ( '안' . charCodeAt ( 0 ) ) ;
37+ expect ( width4 ) . toBe ( 2 ) ;
38+ } ) ;
39+ } ) ;
0 commit comments