@@ -147,7 +147,7 @@ describe('SBT', () => {
147147 expect ( await sbt . balanceOf ( signers . userA . address ) ) . to . eq ( 0 )
148148 } )
149149
150- it ( 'The mint function can be executed by all minters' , async ( ) => {
150+ it ( 'The mint function can be executed by all minters and new minters ' , async ( ) => {
151151 const sbt = await init ( )
152152 const signers = await getSigners ( )
153153
@@ -179,5 +179,49 @@ describe('SBT', () => {
179179 expect ( await sbt . tokenByIndex ( 0 ) ) . to . eq ( 0 )
180180 expect ( await sbt . tokenByIndex ( 1 ) ) . to . eq ( 1 )
181181 } )
182+
183+ it ( 'The mint function can be executed by all minters' , async ( ) => {
184+ const sbt = await init ( )
185+ const signers = await getSigners ( )
186+
187+ await sbt . addMinter ( signers . minterC . address )
188+ const metadata = await getDummyEncodedMetadata ( sbt )
189+ // Execute by Minter A.
190+ await expect (
191+ sbt . connect ( signers . minterA ) . mint ( signers . userA . address , metadata )
192+ )
193+ . to . emit ( sbt , 'Minted' )
194+ . withArgs ( 0 , signers . userA . address )
195+ // Execute by Minter B.
196+ await expect (
197+ sbt . connect ( signers . minterB ) . mint ( signers . userA . address , metadata )
198+ )
199+ . to . emit ( sbt , 'Minted' )
200+ . withArgs ( 1 , signers . userA . address )
201+ // Execute by Minter C.
202+ await expect (
203+ sbt . connect ( signers . minterC ) . mint ( signers . userA . address , metadata )
204+ )
205+ . to . emit ( sbt , 'Minted' )
206+ . withArgs ( 2 , signers . userA . address )
207+
208+ const tokensOfUserA = await sbt . tokensOfOwner ( signers . userA . address )
209+ expect ( tokensOfUserA . length ) . to . eq ( 3 )
210+ expect ( tokensOfUserA [ 0 ] ) . to . eq ( 0 )
211+ expect ( tokensOfUserA [ 1 ] ) . to . eq ( 1 )
212+ expect ( tokensOfUserA [ 2 ] ) . to . eq ( 2 )
213+ expect ( await sbt . totalSupply ( ) ) . to . eq ( 3 )
214+ expect ( await sbt . currentIndex ( ) ) . to . eq ( 3 )
215+ expect ( await sbt . ownerOf ( 0 ) ) . to . eq ( signers . userA . address )
216+ expect ( await sbt . ownerOf ( 1 ) ) . to . eq ( signers . userA . address )
217+ expect ( await sbt . ownerOf ( 2 ) ) . to . eq ( signers . userA . address )
218+ expect ( await sbt . balanceOf ( signers . userA . address ) ) . to . eq ( 3 )
219+ expect ( await sbt . tokenOfOwnerByIndex ( signers . userA . address , 0 ) ) . to . eq ( 0 )
220+ expect ( await sbt . tokenOfOwnerByIndex ( signers . userA . address , 1 ) ) . to . eq ( 1 )
221+ expect ( await sbt . tokenOfOwnerByIndex ( signers . userA . address , 2 ) ) . to . eq ( 2 )
222+ expect ( await sbt . tokenByIndex ( 0 ) ) . to . eq ( 0 )
223+ expect ( await sbt . tokenByIndex ( 1 ) ) . to . eq ( 1 )
224+ expect ( await sbt . tokenByIndex ( 2 ) ) . to . eq ( 2 )
225+ } )
182226 } )
183227} )
0 commit comments