@@ -133,4 +133,61 @@ describe('INTEGRATION: Matchers: revertedWith', () => {
133
133
) ;
134
134
} ) ;
135
135
} ) ;
136
+
137
+ it ( 'Revert success (decorated)' , async ( ) => {
138
+ const matchers = await deploy ( ) ;
139
+ await expect ( matchers . doRevertWithDecoratedCustomErrorName ( ) ) . to . be . revertedWith ( '$__DecoratedCustomErrorName' ) ;
140
+ } ) ;
141
+
142
+ it ( 'Revert fail (decorated)' , async ( ) => {
143
+ const matchers = await deploy ( ) ;
144
+ await expect ( expect ( matchers . doRevertWithDecoratedCustomErrorName ( ) )
145
+ . to . be . revertedWith ( 'Two' )
146
+ ) . to . be . eventually . rejectedWith (
147
+ 'Expected transaction to be reverted with "Two", but other reason was found: "$__DecoratedCustomErrorName"'
148
+ ) ;
149
+ } ) ;
150
+
151
+ it ( 'With args success (decorated)' , async ( ) => {
152
+ const matchers = await deploy ( ) ;
153
+ await expect ( matchers . doRevertWithDecoratedCustomErrorName ( ) )
154
+ . to . be . revertedWith ( '$__DecoratedCustomErrorName' )
155
+ . withArgs (
156
+ 0 ,
157
+ 'message' ,
158
+ '0x00cfbbaf7ddb3a1476767101c12a0162e241fbad2a0162e2410cfbbaf7162123'
159
+ ) ;
160
+ } ) ;
161
+
162
+ it ( 'With args failure (decorated)' , async ( ) => {
163
+ const matchers = await deploy ( ) ;
164
+ await expect ( expect ( matchers . doRevertWithDecoratedCustomErrorName ( ) )
165
+ . to . be . revertedWith ( '$__DecoratedCustomErrorName' )
166
+ . withArgs (
167
+ 1 ,
168
+ 'message' ,
169
+ '0x00cfbbaf7ddb3a1476767101c12a0162e241fbad2a0162e2410cfbbaf7162123'
170
+ )
171
+ ) . to . be . eventually . rejectedWith ( / E x p e c t e d ( " ) ? 0 ( " ) ? t o ( b e ) ? e q u a l 1 / i) ; // It may or may not have the quote marks
172
+ await expect ( expect ( matchers . doRevertWithDecoratedCustomErrorName ( ) )
173
+ . to . be . revertedWith ( '$__DecoratedCustomErrorName' )
174
+ . withArgs (
175
+ 0 ,
176
+ 'messagr' ,
177
+ '0x00cfbbaf7ddb3a1476767101c12a0162e241fbad2a0162e2410cfbbaf7162123'
178
+ )
179
+ ) . to . be . eventually . rejectedWith ( 'expected \'message\' to equal \'messagr\'' ) ;
180
+ await expect ( expect ( matchers . doRevertWithDecoratedCustomErrorName ( ) )
181
+ . to . be . revertedWith ( '$__DecoratedCustomErrorName' )
182
+ . withArgs (
183
+ 0 ,
184
+ 'message' ,
185
+ '0x00cfbbaf7ddb3a1476767101c12a0162e241fbad2a0162e2410cfbbaf7162124'
186
+ )
187
+ ) . to . be . eventually . rejectedWith ( 'expected ' +
188
+ '\'0x00cfbbaf7ddb3a1476767101c12a0162e241fbad2a0162e2410cfbbaf7162123\'' +
189
+ ' to equal ' +
190
+ '\'0x00cfbbaf7ddb3a1476767101c12a0162e241fbad2a0162e2410cfbbaf7162124\''
191
+ ) ;
192
+ } ) ;
136
193
} ) ;
0 commit comments