@@ -271,20 +271,49 @@ export default function({owner}) {
271271
272272 // User cannot set a backup withdrawal address to an invalid address
273273 it ( printTitle ( 'user' , 'cannot set a backup withdrawal address to an invalid address' ) , async ( ) => {
274-
275- // Register withdrawal address
276- let result = await scenarioRegisterWithdrawalAddress ( {
274+ await assertThrows ( scenarioRegisterWithdrawalAddress ( {
277275 withdrawalAddress : '0x0000000000000000000000000000000000000000' ,
278276 miniPool : miniPools . first ,
279277 fromAddress : userFirst ,
280278 gas : 550000 ,
281279 checkLogs : false ,
282- } ) ;
280+ } ) , 'Backup withdrawal address was set' ) ;
281+ } ) ;
282+
283+
284+ // User cannot set a backup withdrawal address to their deposit address
285+ it ( printTitle ( 'user' , 'cannot set a backup withdrawal address to their deposit address' ) , async ( ) => {
286+ await assertThrows ( scenarioRegisterWithdrawalAddress ( {
287+ withdrawalAddress : userFirst ,
288+ miniPool : miniPools . first ,
289+ fromAddress : userFirst ,
290+ gas : 550000 ,
291+ checkLogs : false ,
292+ } ) , 'Backup withdrawal address was set' ) ;
293+ } ) ;
283294
284- // Assert UserSetBackupWithdrawalAddress event was not logged
285- let log = result . logs . find ( ( { event } ) => event == 'UserSetBackupWithdrawalAddress' ) ;
286- assert . equal ( log , undefined , 'UserSetBackupWithdrawalAddress event was logged' ) ;
287295
296+ // User cannot set a backup withdrawal address to an existing deposit address
297+ it ( printTitle ( 'user' , 'cannot set a backup withdrawal address to an existing deposit address' ) , async ( ) => {
298+ await assertThrows ( scenarioRegisterWithdrawalAddress ( {
299+ withdrawalAddress : userSecond ,
300+ miniPool : miniPools . first ,
301+ fromAddress : userFirst ,
302+ gas : 550000 ,
303+ checkLogs : false ,
304+ } ) , 'Backup withdrawal address was set' ) ;
305+ } ) ;
306+
307+
308+ // Random account cannot set a backup withdrawal address
309+ it ( printTitle ( 'random account' , 'cannot set a backup withdrawal address' ) , async ( ) => {
310+ await assertThrows ( scenarioRegisterWithdrawalAddress ( {
311+ withdrawalAddress : userFirstBackupAddress ,
312+ miniPool : miniPools . first ,
313+ fromAddress : accounts [ 9 ] ,
314+ gas : 550000 ,
315+ checkLogs : false ,
316+ } ) , 'Backup withdrawal address was set' ) ;
288317 } ) ;
289318
290319
0 commit comments