@@ -699,4 +699,42 @@ describe('asset labeling contract', () => {
699699
700700 await expect ( ( ) => removeLabelFromAsset ( operatorClient , assetId , label2 ) ) . rejects . toThrow ( / E R R : N O E X I S T / )
701701 } )
702+
703+ test ( 'add label to deleted asset should fail' , async ( ) => {
704+ const { testAccount : adminAccount , algorand } = localnet . context
705+
706+ const { assetId} = await algorand . send . assetCreate ( {
707+ sender : adminAccount . addr ,
708+ total : 1000000n , // Total units of the asset
709+ decimals : 0 , // Number of decimals for the asset
710+ defaultFrozen : false , // Whether the asset is frozen by default
711+ manager : adminAccount . addr , // Address for the asset manager
712+ reserve : adminAccount . addr , // Address for storing reserve assets
713+ freeze : adminAccount . addr , // Address with freezing capabilities
714+ clawback : adminAccount . addr , // Address with clawback rights
715+ unitName : 'UNIT' , // Unit name of the asset
716+ assetName : 'TestAsset' , // Asset name
717+ } )
718+ await algorand . send . assetDestroy ( {
719+ sender : adminAccount . addr ,
720+ assetId
721+ } )
722+
723+
724+ const { adminClient } = await deploy ( adminAccount )
725+ const label = 'wo'
726+ const labelName = 'world'
727+ const labelUrl = 'http://'
728+
729+
730+ await addLabel ( adminClient , adminAccount , label , labelName , labelUrl )
731+ const operator = await localnet . context . generateAccount ( { initialFunds : ( 0.2 ) . algos ( ) } )
732+ await addOperatorToLabel ( adminClient , operator , label )
733+ const operatorClient = adminClient . clone ( {
734+ defaultSender : operator ,
735+ defaultSigner : operator . signer ,
736+ } )
737+ // This should throw
738+ await expect ( ( ) => addLabelToAsset ( operatorClient , assetId , label ) ) . rejects . toThrow ( / E R R : N O E X I S T / )
739+ } )
702740} )
0 commit comments