@@ -249,6 +249,7 @@ describe('BNS API tests', () => {
249
249
canonical : true ,
250
250
tx_id : '' ,
251
251
tx_index : 0 ,
252
+ status : 'name_register'
252
253
} ;
253
254
await db . updateNames ( client , {
254
255
index_block_hash : dbBlock . index_block_hash ,
@@ -266,7 +267,7 @@ describe('BNS API tests', () => {
266
267
const subdomain : DbBnsSubdomain = {
267
268
namespace_id : 'blockstack' ,
268
269
name : 'id.blockstack' ,
269
- fully_qualified_subdomain : 'address_test .id.blockstack' ,
270
+ fully_qualified_subdomain : 'zone_test .id.blockstack' ,
270
271
resolver : 'https://registrar.blockstack.org' ,
271
272
owner : 'STRYYQQ9M8KAF4NS7WNZQYY59X93XEKR31JP64CP' ,
272
273
zonefile : 'test' ,
@@ -418,6 +419,71 @@ describe('BNS API tests', () => {
418
419
expect ( query2 . type ) . toBe ( 'application/json' ) ;
419
420
} ) ;
420
421
422
+ test ( 'Success names transfer' , async ( ) => {
423
+ const blockchain = 'stacks' ;
424
+ const address = 'ST1HB1T8WRNBYB0Y3T7WXZS38NKKPTBR3EG9EPJKA' ;
425
+ const name = 'test-name1' ;
426
+
427
+ const dbName : DbBnsName = {
428
+ name : name ,
429
+ address : address ,
430
+ namespace_id : 'test' ,
431
+ expire_block : 10000 ,
432
+ zonefile : 'test-zone-file' ,
433
+ zonefile_hash : 'zonefileHash' ,
434
+ registered_at : 0 ,
435
+ canonical : true ,
436
+ tx_id : '' ,
437
+ tx_index : 0 ,
438
+ status : 'name-register'
439
+ } ;
440
+ await db . updateNames ( client , {
441
+ index_block_hash : dbBlock . index_block_hash ,
442
+ parent_index_block_hash : dbBlock . parent_index_block_hash ,
443
+ microblock_hash : '' ,
444
+ microblock_sequence : I32_MAX ,
445
+ microblock_canonical : true ,
446
+ } , dbName ) ;
447
+
448
+ const query1 = await supertest ( api . server ) . get ( `/v1/addresses/${ blockchain } /${ address } ` ) ;
449
+ expect ( query1 . status ) . toBe ( 200 ) ;
450
+ expect ( query1 . body . names [ 0 ] ) . toBe ( name ) ;
451
+ expect ( query1 . type ) . toBe ( 'application/json' ) ;
452
+
453
+ const address1 = 'ST1HB1T8WRNBYB0Y3T7WXZS38NKKPTBR3EG9EPJKT' ;
454
+
455
+ const dbNameTransfer : DbBnsName = {
456
+ name : name ,
457
+ address : address1 ,
458
+ namespace_id : 'test' ,
459
+ expire_block : 10000 ,
460
+ zonefile : 'test-zone-file' ,
461
+ zonefile_hash : 'zonefileHash' ,
462
+ registered_at : 1 ,
463
+ canonical : true ,
464
+ tx_id : '' ,
465
+ tx_index : 0 ,
466
+ status : 'name-transfer'
467
+ } ;
468
+ await db . updateNames ( client , {
469
+ index_block_hash : dbBlock . index_block_hash ,
470
+ parent_index_block_hash : dbBlock . parent_index_block_hash ,
471
+ microblock_hash : '' ,
472
+ microblock_sequence : I32_MAX ,
473
+ microblock_canonical : true ,
474
+ } , dbNameTransfer ) ;
475
+
476
+ const query2 = await supertest ( api . server ) . get ( `/v1/addresses/${ blockchain } /${ address1 } ` ) ;
477
+ expect ( query2 . status ) . toBe ( 200 ) ;
478
+ expect ( query2 . type ) . toBe ( 'application/json' ) ;
479
+ expect ( query2 . body . names [ 0 ] ) . toBe ( name ) ;
480
+
481
+ const query3 = await supertest ( api . server ) . get ( `/v1/addresses/${ blockchain } /${ address } ` ) ;
482
+ expect ( query3 . status ) . toBe ( 200 ) ;
483
+ expect ( query3 . type ) . toBe ( 'application/json' ) ;
484
+ expect ( query3 . body . names . length ) . toBe ( 0 ) ;
485
+ } ) ;
486
+
421
487
test ( 'Fail names by address - Blockchain not support' , async ( ) => {
422
488
const query1 = await supertest ( api . server ) . get ( `/v1/addresses/invalid/test` ) ;
423
489
expect ( query1 . status ) . toBe ( 404 ) ;
@@ -458,7 +524,7 @@ describe('BNS API tests', () => {
458
524
const subdomain : DbBnsSubdomain = {
459
525
namespace_id : 'blockstack' ,
460
526
name : 'id.blockstack' ,
461
- fully_qualified_subdomain : 'address_test .id.blockstack' ,
527
+ fully_qualified_subdomain : 'zonefile_test .id.blockstack' ,
462
528
resolver : 'https://registrar.blockstack.org' ,
463
529
owner : address ,
464
530
zonefile : 'test' ,
0 commit comments