@@ -275,6 +275,45 @@ describe('SBT', () => {
275275 } )
276276 } )
277277
278+ describe ( 'transfer' , ( ) => {
279+ it ( 'The transfer function should not work if owner' , async ( ) => {
280+ const sbt = await init ( )
281+ const signers = await getSigners ( )
282+
283+ const metadata = await getDummyEncodedMetadata ( sbt )
284+ await expect (
285+ sbt . connect ( signers . minterA ) . mint ( signers . userA . address , metadata )
286+ )
287+ . to . emit ( sbt , 'Minted' )
288+ . withArgs ( 0 , signers . userA . address )
289+
290+ await expect (
291+ sbt
292+ . connect ( signers . userA )
293+ . transferFrom ( signers . userA . address , signers . userB . address , 0 )
294+ ) . to . revertedWith ( 'SBT can not transfer' )
295+ } )
296+
297+ it ( 'The transfer function should not work if approved user' , async ( ) => {
298+ const sbt = await init ( )
299+ const signers = await getSigners ( )
300+
301+ const metadata = await getDummyEncodedMetadata ( sbt )
302+ await expect (
303+ sbt . connect ( signers . minterA ) . mint ( signers . userA . address , metadata )
304+ )
305+ . to . emit ( sbt , 'Minted' )
306+ . withArgs ( 0 , signers . userA . address )
307+
308+ await sbt . connect ( signers . userA ) . approve ( signers . userB . address , 0 )
309+ await expect (
310+ sbt
311+ . connect ( signers . userB )
312+ . transferFrom ( signers . userA . address , signers . minterA . address , 0 )
313+ ) . to . revertedWith ( 'SBT can not transfer' )
314+ } )
315+ } )
316+
278317 describe ( 'setTokenURI' , ( ) => {
279318 it ( 'The setTokenURI function can be executed by minter' , async ( ) => {
280319 const sbt = await init ( )
@@ -387,7 +426,6 @@ describe('SBT', () => {
387426 . withArgs ( 0 , modifiedMetadata )
388427 } )
389428
390-
391429 it ( 'The setTokenURI function should function correctly for multiple users' , async ( ) => {
392430 const sbt = await init ( )
393431 const signers = await getSigners ( )
0 commit comments