@@ -67,6 +67,24 @@ import {
6767 renewalRule : 52595 ,
6868 nameImporter : alice ,
6969 zonefile : "1111" ,
70+ } ,
71+ {
72+ namespace : "btc" ,
73+ version : 1 ,
74+ salt : "0000" ,
75+ value : 64000000000 ,
76+ namespaceOwner : alice ,
77+ nameOwner : bob ,
78+ priceFunction : {
79+ buckets : [ 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 ] ,
80+ base : 1000 ,
81+ coeff : 200 ,
82+ noVowelDiscount : 1 ,
83+ nonAlphaDiscount : 1 ,
84+ } ,
85+ renewalRule : 52595 ,
86+ nameImporter : alice ,
87+ zonefile : "2222" ,
7088 } ] ;
7189
7290 beforeEach ( async ( ) => {
@@ -94,6 +112,42 @@ import {
94112 await bns . deployContract ( ) ;
95113 } ) ;
96114
115+ it ( "Test btc namespace price" , async ( ) => {
116+ var receipt = await bns . namespacePreorder ( cases [ 2 ] . namespace , cases [ 2 ] . salt , cases [ 2 ] . value , {
117+ sender : cases [ 2 ] . namespaceOwner
118+ } ) ;
119+ expect ( receipt . success ) . eq ( true ) ;
120+ expect ( receipt . result ) . include ( 'u146' ) ;
121+
122+ receipt = await bns . namespaceReveal (
123+ cases [ 2 ] . namespace ,
124+ cases [ 2 ] . salt ,
125+ cases [ 2 ] . priceFunction ,
126+ cases [ 2 ] . renewalRule ,
127+ cases [ 2 ] . nameImporter , {
128+ sender : cases [ 2 ] . namespaceOwner
129+ } ) ;
130+ expect ( receipt . success ) . eq ( true ) ;
131+ expect ( receipt . result ) . include ( 'true' ) ;
132+
133+ receipt = await bns . namespaceReady ( cases [ 2 ] . namespace , {
134+ sender : cases [ 2 ] . namespaceOwner
135+ } ) ;
136+ expect ( receipt . success ) . eq ( true ) ;
137+ expect ( receipt . result ) . include ( 'true' ) ;
138+
139+ var receipt = await bns . getNamePrice ( cases [ 2 ] . namespace , "a" ) ;
140+ expect ( receipt . success ) . eq ( true ) ;
141+ // 2 STX
142+ expect ( receipt . result ) . include ( `(ok u2000000)` ) ;
143+
144+ var receipt = await bns . getNamePrice ( cases [ 2 ] . namespace , "abcdefghijk123456789" ) ;
145+ expect ( receipt . success ) . eq ( true ) ;
146+ // 2 STX
147+ expect ( receipt . result ) . include ( `(ok u2000000)` ) ;
148+
149+ } ) ;
150+
97151 it ( "Testing name prices" , async ( ) => {
98152 // Given a launched namespace 'blockstack', owned by Alice
99153 var receipt = await bns . namespacePreorder ( cases [ 0 ] . namespace , cases [ 0 ] . salt , cases [ 0 ] . value , {
0 commit comments