@@ -40,44 +40,48 @@ contract('SignatureChecker (ERC1271)', function (accounts) {
40
40
} ) ;
41
41
42
42
context ( 'ERC1271 wallet' , function ( ) {
43
- it ( 'with matching signer and signature' , async function ( ) {
44
- expect (
45
- await this . signaturechecker . $isValidSignatureNow (
46
- this . wallet . address ,
47
- toEthSignedMessageHash ( TEST_MESSAGE ) ,
48
- this . signature ,
49
- ) ,
50
- ) . to . equal ( true ) ;
51
- } ) ;
43
+ for ( const signature of [ 'isValidERC1271SignatureNow' , 'isValidSignatureNow' ] ) {
44
+ context ( signature , function ( ) {
45
+ it ( 'with matching signer and signature' , async function ( ) {
46
+ expect (
47
+ await this . signaturechecker [ `$${ signature } ` ] (
48
+ this . wallet . address ,
49
+ toEthSignedMessageHash ( TEST_MESSAGE ) ,
50
+ this . signature ,
51
+ ) ,
52
+ ) . to . equal ( true ) ;
53
+ } ) ;
52
54
53
- it ( 'with invalid signer' , async function ( ) {
54
- expect (
55
- await this . signaturechecker . $isValidSignatureNow (
56
- this . signaturechecker . address ,
57
- toEthSignedMessageHash ( TEST_MESSAGE ) ,
58
- this . signature ,
59
- ) ,
60
- ) . to . equal ( false ) ;
61
- } ) ;
55
+ it ( 'with invalid signer' , async function ( ) {
56
+ expect (
57
+ await this . signaturechecker [ `$ ${ signature } ` ] (
58
+ this . signaturechecker . address ,
59
+ toEthSignedMessageHash ( TEST_MESSAGE ) ,
60
+ this . signature ,
61
+ ) ,
62
+ ) . to . equal ( false ) ;
63
+ } ) ;
62
64
63
- it ( 'with invalid signature' , async function ( ) {
64
- expect (
65
- await this . signaturechecker . $isValidSignatureNow (
66
- this . wallet . address ,
67
- toEthSignedMessageHash ( WRONG_MESSAGE ) ,
68
- this . signature ,
69
- ) ,
70
- ) . to . equal ( false ) ;
71
- } ) ;
65
+ it ( 'with invalid signature' , async function ( ) {
66
+ expect (
67
+ await this . signaturechecker [ `$ ${ signature } ` ] (
68
+ this . wallet . address ,
69
+ toEthSignedMessageHash ( WRONG_MESSAGE ) ,
70
+ this . signature ,
71
+ ) ,
72
+ ) . to . equal ( false ) ;
73
+ } ) ;
72
74
73
- it ( 'with malicious wallet' , async function ( ) {
74
- expect (
75
- await this . signaturechecker . $isValidSignatureNow (
76
- this . malicious . address ,
77
- toEthSignedMessageHash ( TEST_MESSAGE ) ,
78
- this . signature ,
79
- ) ,
80
- ) . to . equal ( false ) ;
81
- } ) ;
75
+ it ( 'with malicious wallet' , async function ( ) {
76
+ expect (
77
+ await this . signaturechecker [ `$${ signature } ` ] (
78
+ this . malicious . address ,
79
+ toEthSignedMessageHash ( TEST_MESSAGE ) ,
80
+ this . signature ,
81
+ ) ,
82
+ ) . to . equal ( false ) ;
83
+ } ) ;
84
+ } ) ;
85
+ }
82
86
} ) ;
83
87
} ) ;
0 commit comments