@@ -245,6 +245,15 @@ contract("Voting Token", (accounts) => {
245245 expect ( motion . skillId ) . to . eq . BN ( domain1 . skillId ) ;
246246 } ) ;
247247
248+ it ( "can lock the token when a motion is created" , async ( ) => {
249+ const action = await encodeTxData ( colony , "makeTask" , [ 1 , UINT256_MAX , FAKE , 1 , 0 , 0 ] ) ;
250+ await voting . createRootMotion ( ADDRESS_ZERO , action ) ;
251+ const motionId = await voting . getMotionCount ( ) ;
252+
253+ const lockId = await voting . getLockId ( motionId ) ;
254+ expect ( lockId ) . to . not . be . zero ;
255+ } ) ;
256+
248257 it ( "can create a motion with an alternative target" , async ( ) => {
249258 const action = await encodeTxData ( colony , "makeTask" , [ 1 , 0 , FAKE , 2 , 0 , 0 ] ) ;
250259 await voting . createRootMotion ( voting . address , action ) ;
@@ -635,6 +644,18 @@ contract("Voting Token", (accounts) => {
635644 await voting . revealVote ( motionId , SALT , NAY , { from : USER0 } ) ;
636645 } ) ;
637646
647+ it ( "can unlock the token once revealed" , async ( ) => {
648+ await voting . submitVote ( motionId , soliditySha3 ( SALT , NAY ) , { from : USER0 } ) ;
649+
650+ await forwardTime ( SUBMIT_PERIOD , this ) ;
651+
652+ await voting . revealVote ( motionId , SALT , NAY , { from : USER0 } ) ;
653+
654+ const lockId = await voting . getLockId ( motionId ) ;
655+ const { lockCount } = await tokenLocking . getUserLock ( token . address , USER0 ) ;
656+ expect ( lockCount ) . to . eq . BN ( lockId ) ;
657+ } ) ;
658+
638659 it ( "can tally votes from two users" , async ( ) => {
639660 await voting . submitVote ( motionId , soliditySha3 ( SALT , YAY ) , { from : USER0 } ) ;
640661 await voting . submitVote ( motionId , soliditySha3 ( SALT , YAY ) , { from : USER1 } ) ;
@@ -910,6 +931,10 @@ contract("Voting Token", (accounts) => {
910931 } ) ;
911932
912933 it ( "cannot take an action if there is insufficient voting power (state change actions)" , async ( ) => {
934+ // Clear the locks
935+ await tokenLocking . methods [ "deposit(address,uint256,bool)" ] ( token . address , 0 , true , { from : USER0 } ) ;
936+ await tokenLocking . methods [ "deposit(address,uint256,bool)" ] ( token . address , 0 , true , { from : USER1 } ) ;
937+
913938 // Set globalClaimDelay to WAD
914939 await colony . makeExpenditure ( 1 , UINT256_MAX , 1 ) ;
915940 const expenditureId = await colony . getExpenditureCount ( ) ;
@@ -955,6 +980,10 @@ contract("Voting Token", (accounts) => {
955980 } ) ;
956981
957982 it ( "can set vote power correctly after a vote" , async ( ) => {
983+ // Clear the locks
984+ await tokenLocking . methods [ "deposit(address,uint256,bool)" ] ( token . address , 0 , true , { from : USER0 } ) ;
985+ await tokenLocking . methods [ "deposit(address,uint256,bool)" ] ( token . address , 0 , true , { from : USER1 } ) ;
986+
958987 await colony . makeExpenditure ( 1 , UINT256_MAX , 1 ) ;
959988 const expenditureId = await colony . getExpenditureCount ( ) ;
960989
0 commit comments