File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -51,20 +51,21 @@ describe('Base64', function () {
51
51
} ) ;
52
52
53
53
it ( 'Decode invalid base64 string' , async function ( ) {
54
+ const getHexCode = str => ethers . hexlify ( ethers . toUtf8Bytes ( str ) ) ;
54
55
const helper = { interface : ethers . Interface . from ( [ 'error InvalidBase64Digit(bytes1)' ] ) } ;
55
56
56
57
// ord('$') < 43
57
58
await expect ( this . mock . $decode ( 'dGVzd$==' ) )
58
59
. to . be . revertedWithCustomError ( helper , 'InvalidBase64Digit' )
59
- . withArgs ( `0x ${ '$' . charCodeAt ( 0 ) . toString ( 16 ) } ` ) ;
60
+ . withArgs ( getHexCode ( '$' ) ) ;
60
61
// ord('~') > 122
61
62
await expect ( this . mock . $decode ( 'dGVzd~==' ) )
62
63
. to . be . revertedWithCustomError ( helper , 'InvalidBase64Digit' )
63
- . withArgs ( `0x ${ '~' . charCodeAt ( 0 ) . toString ( 16 ) } ` ) ;
64
+ . withArgs ( getHexCode ( '~' ) ) ;
64
65
// ord('@') in range, but '@' not in the dictionary
65
66
await expect ( this . mock . $decode ( 'dGVzd@==' ) )
66
67
. to . be . revertedWithCustomError ( helper , 'InvalidBase64Digit' )
67
- . withArgs ( `0x ${ '@' . charCodeAt ( 0 ) . toString ( 16 ) } ` ) ;
68
+ . withArgs ( getHexCode ( '@' ) ) ;
68
69
} ) ;
69
70
70
71
it ( 'Encode reads beyond the input buffer into dirty memory' , async function ( ) {
You can’t perform that action at this time.
0 commit comments