@@ -668,6 +668,27 @@ contract("Colony Funding", (accounts) => {
668668 await checkErrorRevert ( receiver . setColonyAddress ( ADDRESS_ZERO , { from : colonyNetwork . address } ) , "domain-token-receiver-colony-already-set" ) ;
669669 } ) ;
670670
671+ it ( "can get the colony a domainTokenReceiver is associated with" , async ( ) => {
672+ await colony . addDomain ( 1 , UINT256_MAX , 1 ) ;
673+ const receiverAddress = await colonyNetwork . getDomainTokenReceiverAddress ( colony . address , 2 ) ;
674+ await colony . claimDomainFunds ( ethers . constants . AddressZero , 2 ) ;
675+ const receiver = await DomainTokenReceiver . at ( receiverAddress ) ;
676+
677+ const associatedColony = await receiver . getColony ( ) ;
678+ expect ( associatedColony ) . to . equal ( colony . address ) ;
679+ } ) ;
680+
681+ it ( "when receiving native (reputation-earning) token, if being received by root domain, only DomainFundsClaimed event is emitted" , async ( ) => {
682+ // Get address for domain 1
683+ const receiverAddress = await colonyNetwork . getDomainTokenReceiverAddress ( colony . address , 1 ) ;
684+ const txData = token . contract . methods [ "mint(address,uint256)" ] ( receiverAddress , 100 ) . encodeABI ( ) ;
685+ await colony . makeArbitraryTransaction ( token . address , txData ) ;
686+
687+ const tx = await colony . claimDomainFunds ( token . address , 1 ) ;
688+ expect ( tx . logs . filter ( ( l ) => l . event === "DomainFundsClaimed" ) . length ) . to . equal ( 1 ) ;
689+ expect ( tx . logs . filter ( ( l ) => l . event === "ColonyFundsClaimed" ) . length ) . to . equal ( 0 ) ;
690+ } ) ;
691+
671692 it ( "when receiving native (reputation-earning) token, if no approval present for domain, all are received by root domain" , async ( ) => {
672693 // Get address for domain 2
673694 await colony . addDomain ( 1 , UINT256_MAX , 1 ) ;
0 commit comments