@@ -212,6 +212,85 @@ describe('Subdomain registrar', () => {
212
212
} )
213
213
} )
214
214
215
+ describe ( 'renew' , ( ) => {
216
+ it ( 'should allow subdomains to be renewed' , async ( ) => {
217
+ await BaseRegistrar . register ( labelhash ( 'test' ) , account , 200000 )
218
+ await BaseRegistrar . setApprovalForAll ( NameWrapper . address , true )
219
+ await NameWrapper . wrapETH2LD (
220
+ 'test' ,
221
+ account ,
222
+ 0 ,
223
+ MAX_EXPIRY ,
224
+ EMPTY_ADDRESS
225
+ )
226
+ expect ( await NameWrapper . ownerOf ( node ) ) . to . equal ( account )
227
+ await SubdomainRegistrar . setupDomain ( node , Erc20 . address , 1 , account )
228
+ await NameWrapper . setApprovalForAll ( SubdomainRegistrar . address , true )
229
+ await Erc20WithAccount2 . approve (
230
+ SubdomainRegistrar . address ,
231
+ ethers . constants . MaxUint256
232
+ )
233
+ await SubdomainRegistrar2 . register (
234
+ node ,
235
+ 'subname' ,
236
+ account2 ,
237
+ EMPTY_ADDRESS ,
238
+ 0 ,
239
+ 86400 ,
240
+ [ ]
241
+ )
242
+
243
+ const [ , expiry ] = await NameWrapper . getFuses (
244
+ namehash ( 'subname.test.eth' )
245
+ )
246
+
247
+ expect ( await NameWrapper . ownerOf ( subNode ) ) . to . equal ( account2 )
248
+
249
+ await SubdomainRegistrar2 . renew ( node , labelhash ( 'subname' ) , 86400 )
250
+ const [ , expiry2 ] = await NameWrapper . getFuses (
251
+ namehash ( 'subname.test.eth' )
252
+ )
253
+ expect ( expiry2 . toNumber ( ) ) . to . be . greaterThan ( expiry . toNumber ( ) )
254
+ } )
255
+
256
+ it ( 'should allow subdomains to be renewed even with 0 registration fee' , async ( ) => {
257
+ await BaseRegistrar . register ( labelhash ( 'test' ) , account , 200000 )
258
+ await BaseRegistrar . setApprovalForAll ( NameWrapper . address , true )
259
+ await NameWrapper . wrapETH2LD (
260
+ 'test' ,
261
+ account ,
262
+ 0 ,
263
+ MAX_EXPIRY ,
264
+ EMPTY_ADDRESS
265
+ )
266
+ expect ( await NameWrapper . ownerOf ( node ) ) . to . equal ( account )
267
+ await SubdomainRegistrar . setupDomain ( node , Erc20 . address , 0 , account )
268
+ await NameWrapper . setApprovalForAll ( SubdomainRegistrar . address , true )
269
+ await SubdomainRegistrar2 . register (
270
+ node ,
271
+ 'subname' ,
272
+ account2 ,
273
+ EMPTY_ADDRESS ,
274
+ 0 ,
275
+ 86400 ,
276
+ [ ]
277
+ )
278
+
279
+ const [ , expiry ] = await NameWrapper . getFuses (
280
+ namehash ( 'subname.test.eth' )
281
+ )
282
+
283
+ expect ( await NameWrapper . ownerOf ( subNode ) ) . to . equal ( account2 )
284
+
285
+ await SubdomainRegistrar2 . renew ( node , labelhash ( 'subname' ) , 86400 )
286
+ const [ , expiry2 ] = await NameWrapper . getFuses (
287
+ namehash ( 'subname.test.eth' )
288
+ )
289
+
290
+ expect ( expiry2 . toNumber ( ) ) . to . be . greaterThan ( expiry . toNumber ( ) )
291
+ } )
292
+ } )
293
+
215
294
describe ( 'register Subnames with records' , ( ) => {
216
295
it ( 'should allow a subname to be registered with records' , async ( ) => {
217
296
const node = namehash ( 'test.eth' )
0 commit comments