@@ -159,7 +159,9 @@ describe('single-byte encodings index: Unicode', () => {
159159 t . assert . strictEqual ( decoderLoose ( Uint8Array . of ( byte ) ) , str )
160160 t . assert . strictEqual ( decoder ( toShared ( Uint8Array . of ( byte ) ) ) , str )
161161 t . assert . strictEqual ( decoderLoose ( toShared ( Uint8Array . of ( byte ) ) ) , str )
162- t . assert . deepStrictEqual ( encoder ( str ) , Uint8Array . of ( byte ) )
162+ const u8 = encoder ( str )
163+ t . assert . deepStrictEqual ( u8 , Uint8Array . of ( byte ) )
164+ t . assert . strictEqual ( u8 . byteLength , u8 . buffer . byteLength )
163165 }
164166 }
165167 } )
@@ -214,7 +216,9 @@ describe('single-byte encodings index: WHATWG', () => {
214216 t . assert . strictEqual ( str , decoderLoose ( Uint8Array . of ( byte ) ) )
215217 t . assert . strictEqual ( decoder ( toShared ( Uint8Array . of ( byte ) ) ) , str )
216218 t . assert . strictEqual ( decoderLoose ( toShared ( Uint8Array . of ( byte ) ) ) , str )
217- t . assert . deepStrictEqual ( encoder ( str ) , Uint8Array . of ( byte ) )
219+ const u8 = encoder ( str )
220+ t . assert . deepStrictEqual ( u8 , Uint8Array . of ( byte ) )
221+ t . assert . strictEqual ( u8 . byteLength , u8 . buffer . byteLength )
218222 } else {
219223 t . assert . throws ( ( ) => decoder ( Uint8Array . of ( byte ) ) )
220224 t . assert . throws ( ( ) => decoder ( toShared ( Uint8Array . of ( byte ) ) ) )
@@ -263,7 +267,9 @@ describe('single-byte encodings index: WHATWG non-normative indexes.json', () =>
263267 t . assert . strictEqual ( decoderLoose ( Uint8Array . of ( byte ) ) , str )
264268 t . assert . strictEqual ( decoder ( toShared ( Uint8Array . of ( byte ) ) ) , str )
265269 t . assert . strictEqual ( decoderLoose ( toShared ( Uint8Array . of ( byte ) ) ) , str )
266- t . assert . deepStrictEqual ( encoder ( str ) , Uint8Array . of ( byte ) )
270+ const u8 = encoder ( str )
271+ t . assert . deepStrictEqual ( u8 , Uint8Array . of ( byte ) )
272+ t . assert . strictEqual ( u8 . byteLength , u8 . buffer . byteLength )
267273 } else {
268274 t . assert . throws ( ( ) => decoder ( Uint8Array . of ( byte ) ) )
269275 t . assert . throws ( ( ) => decoder ( toShared ( Uint8Array . of ( byte ) ) ) )
@@ -294,7 +300,9 @@ describe('x-user-defined', () => {
294300 const encoder = createSinglebyteEncoder ( encoding )
295301 for ( let byte = 0 ; byte < 256 ; byte ++ ) {
296302 const str = String . fromCodePoint ( byte >= 0x80 ? 0xf7_80 + byte - 0x80 : byte )
297- t . assert . deepStrictEqual ( encoder ( str ) , Uint8Array . of ( byte ) , byte )
303+ const u8 = encoder ( str )
304+ t . assert . deepStrictEqual ( u8 , Uint8Array . of ( byte ) )
305+ t . assert . strictEqual ( u8 . byteLength , u8 . buffer . byteLength )
298306 }
299307
300308 for ( let i = 128 ; i < 512 ; i ++ ) {
0 commit comments