@@ -17,9 +17,19 @@ describe("constructor", () => {
17
17
} ) ;
18
18
19
19
test ( "throws when providing no or incorrect buffer" , ( ) => {
20
- expect ( ( ) => new WalkableBuffer ( { buffer : null as any } ) ) . toThrow ( ) ;
21
20
expect (
22
- ( ) => new WalkableBuffer ( { buffer : { a : 1 , b : 2 } as any } ) ,
21
+ ( ) =>
22
+ new WalkableBuffer ( {
23
+ // @ts -expect-error
24
+ buffer : null ,
25
+ } ) ,
26
+ ) . toThrow ( ) ;
27
+ expect (
28
+ ( ) =>
29
+ new WalkableBuffer ( {
30
+ // @ts -expect-error
31
+ buffer : { a : 1 , b : 2 } ,
32
+ } ) ,
23
33
) . toThrow ( ) ;
24
34
} ) ;
25
35
@@ -39,7 +49,8 @@ describe("constructor", () => {
39
49
( ) =>
40
50
new WalkableBuffer ( {
41
51
buffer,
42
- endianness : "QQ" as any ,
52
+ // @ts -expect-error
53
+ endianness : "QQ" ,
43
54
} ) ,
44
55
) . toThrow ( / I n v a l i d e n d i a n n e s s / ) ;
45
56
} ) ;
@@ -60,7 +71,8 @@ describe("constructor", () => {
60
71
( ) =>
61
72
new WalkableBuffer ( {
62
73
buffer,
63
- encoding : "STEVEN" as any ,
74
+ // @ts -expect-error
75
+ encoding : "STEVEN" ,
64
76
} ) ,
65
77
) . toThrow ( / I n v a l i d e n c o d i n g / ) ;
66
78
} ) ;
@@ -112,7 +124,8 @@ describe("constructor", () => {
112
124
( ) =>
113
125
new WalkableBuffer ( {
114
126
buffer,
115
- signed : "hello" as any ,
127
+ // @ts -expect-error
128
+ signed : "hello" ,
116
129
} ) ,
117
130
) . toThrow ( ) ;
118
131
} ) ;
@@ -200,7 +213,8 @@ describe("integer functions", () => {
200
213
201
214
test ( "reads NOT (throws)" , ( ) => {
202
215
expect ( ( ) =>
203
- walkableBuffer . get ( SHORT , "NOT" as any ) ,
216
+ // @ts -expect-error
217
+ walkableBuffer . get ( SHORT , "NOT" ) ,
204
218
) . toThrow ( / i n v a l i d e n d i a n n e s s / i) ;
205
219
} ) ;
206
220
} ) ;
@@ -593,7 +607,8 @@ describe("integer functions", () => {
593
607
594
608
test ( "reads NOT (throws)" , ( ) => {
595
609
expect ( ( ) =>
596
- walkableBuffer . getBigInt ( "NOT" as any ) ,
610
+ // @ts -expect-error
611
+ walkableBuffer . getBigInt ( "NOT" ) ,
597
612
) . toThrow ( / i n v a l i d e n d i a n n e s s / i) ;
598
613
} ) ;
599
614
} ) ;
@@ -881,7 +896,8 @@ describe("integer functions", () => {
881
896
882
897
test ( "reads NOT (throws)" , ( ) => {
883
898
expect ( ( ) =>
884
- walkableBuffer . peekBigInt ( 0 , "NOT" as any ) ,
899
+ // @ts -expect-error
900
+ walkableBuffer . peekBigInt ( 0 , "NOT" ) ,
885
901
) . toThrow ( / i n v a l i d e n d i a n n e s s / i) ;
886
902
} ) ;
887
903
} ) ;
@@ -1098,7 +1114,11 @@ describe("string functions", () => {
1098
1114
1099
1115
test ( "throws on invalid encoding" , ( ) => {
1100
1116
expect ( ( ) =>
1101
- u16walkableBuffer . getString ( 1 , "notAnEncoding" as any ) ,
1117
+ u16walkableBuffer . getString (
1118
+ 1 ,
1119
+ //@ts -expect-error
1120
+ "notAnEncoding" ,
1121
+ ) ,
1102
1122
) . toThrow ( / u n k n o w n e n c o d i n g / i) ;
1103
1123
} ) ;
1104
1124
} ) ;
@@ -1169,7 +1189,12 @@ describe("string functions", () => {
1169
1189
1170
1190
test ( "throws on invalid encoding" , ( ) => {
1171
1191
expect ( ( ) =>
1172
- u16walkableBuffer . peekString ( 1 , 0 , "notAnEncoding" as any ) ,
1192
+ u16walkableBuffer . peekString (
1193
+ 1 ,
1194
+ 0 ,
1195
+ // @ts -expect-error
1196
+ "notAnEncoding" ,
1197
+ ) ,
1173
1198
) . toThrow ( / u n k n o w n e n c o d i n g / i) ;
1174
1199
} ) ;
1175
1200
} ) ;
@@ -1623,7 +1648,12 @@ describe("string functions", () => {
1623
1648
} ) ;
1624
1649
1625
1650
test ( "set NOT (throws)" , ( ) => {
1626
- expect ( ( ) => wBuf . setEndianness ( "NOT" as any ) ) . toThrow ( ) ;
1651
+ expect ( ( ) =>
1652
+ wBuf . setEndianness (
1653
+ // @ts -expect-error
1654
+ "NOT" ,
1655
+ ) ,
1656
+ ) . toThrow ( ) ;
1627
1657
expect ( wBuf . getEndianness ( ) ) . toBe ( "LE" ) ;
1628
1658
} ) ;
1629
1659
} ) ;
@@ -1668,9 +1698,12 @@ describe("string functions", () => {
1668
1698
} ) ;
1669
1699
1670
1700
test ( "set NOT (throws)" , ( ) => {
1671
- expect ( ( ) => wBuf . setEncoding ( "NOT" as any ) ) . toThrow (
1672
- / i n v a l i d e n c o d i n g / i,
1673
- ) ;
1701
+ expect ( ( ) =>
1702
+ wBuf . setEncoding (
1703
+ // @ts -expect-error
1704
+ "NOT" ,
1705
+ ) ,
1706
+ ) . toThrow ( / i n v a l i d e n c o d i n g / i) ;
1674
1707
expect ( wBuf . getEncoding ( ) ) . toBe ( "utf8" ) ;
1675
1708
} ) ;
1676
1709
} ) ;
0 commit comments