@@ -50,7 +50,7 @@ describe('VotingReminderTriggerHandler', () => {
5050 } as any ;
5151
5252 mockAnticaptureClient = {
53- listVotesOnchains : jest . fn ( )
53+ getProposalNonVoters : jest . fn ( )
5454 } as any ;
5555
5656 handler = new VotingReminderTriggerHandler (
@@ -88,16 +88,8 @@ describe('VotingReminderTriggerHandler', () => {
8888
8989 // Setup mocks
9090 mockSubscriptionClient . getFollowedAddresses . mockResolvedValue ( [ '0x123' , '0x456' ] ) ;
91- mockAnticaptureClient . listVotesOnchains . mockResolvedValue ( [
92- {
93- daoId : 'test-dao' ,
94- txHash : '0xtest' ,
95- proposalId : 'proposal-123' ,
96- voterAccountId : '0x123' ,
97- support : '1' ,
98- votingPower : '100' ,
99- timestamp : '1234567890'
100- } // Only 0x123 has voted
91+ mockAnticaptureClient . getProposalNonVoters . mockResolvedValue ( [
92+ { voter : '0x456' } // Only 0x456 hasn't voted
10193 ] ) ;
10294 mockSubscriptionClient . getWalletOwnersBatch . mockResolvedValue ( {
10395 '0x456' : [ mockUser ] // Only 0x456 (non-voter) has users
@@ -112,11 +104,11 @@ describe('VotingReminderTriggerHandler', () => {
112104
113105 expect ( result . messageId ) . toMatch ( / v o t i n g - r e m i n d e r - / ) ;
114106 expect ( mockSubscriptionClient . getFollowedAddresses ) . toHaveBeenCalledWith ( 'test-dao' ) ;
115- expect ( mockAnticaptureClient . listVotesOnchains ) . toHaveBeenCalledWith ( {
116- daoId : 'test-dao ',
117- proposalId_in : [ 'proposal-123' ] ,
118- voterAccountId_in : [ '0x123' , '0x456' ]
119- } ) ;
107+ expect ( mockAnticaptureClient . getProposalNonVoters ) . toHaveBeenCalledWith (
108+ 'proposal-123 ',
109+ 'test-dao' ,
110+ [ '0x123' , '0x456' ]
111+ ) ;
120112 expect ( mockSubscriptionClient . getWalletOwnersBatch ) . toHaveBeenCalledWith ( [ '0x456' ] ) ;
121113 } ) ;
122114
@@ -131,7 +123,7 @@ describe('VotingReminderTriggerHandler', () => {
131123 const result = await handler . handleMessage ( message ) ;
132124
133125 expect ( result . messageId ) . toMatch ( / v o t i n g - r e m i n d e r - / ) ;
134- expect ( mockAnticaptureClient . listVotesOnchains ) . not . toHaveBeenCalled ( ) ;
126+ expect ( mockAnticaptureClient . getProposalNonVoters ) . not . toHaveBeenCalled ( ) ;
135127 } ) ;
136128
137129 it ( 'should skip when all users have already voted' , async ( ) => {
@@ -141,17 +133,7 @@ describe('VotingReminderTriggerHandler', () => {
141133 } ;
142134
143135 mockSubscriptionClient . getFollowedAddresses . mockResolvedValue ( [ '0x123' ] ) ;
144- mockAnticaptureClient . listVotesOnchains . mockResolvedValue ( [
145- {
146- daoId : 'test-dao' ,
147- txHash : '0xtest' ,
148- proposalId : 'proposal-123' ,
149- voterAccountId : '0x123' ,
150- support : '1' ,
151- votingPower : '100' ,
152- timestamp : '1234567890'
153- } // All addresses have voted
154- ] ) ;
136+ mockAnticaptureClient . getProposalNonVoters . mockResolvedValue ( [ ] ) ; // Empty array - all have voted
155137
156138 const result = await handler . handleMessage ( message ) ;
157139
@@ -166,7 +148,9 @@ describe('VotingReminderTriggerHandler', () => {
166148 } ;
167149
168150 mockSubscriptionClient . getFollowedAddresses . mockResolvedValue ( [ '0x456' ] ) ;
169- mockAnticaptureClient . listVotesOnchains . mockResolvedValue ( [ ] ) ; // No votes
151+ mockAnticaptureClient . getProposalNonVoters . mockResolvedValue ( [
152+ { voter : '0x456' }
153+ ] ) ;
170154 mockSubscriptionClient . getWalletOwnersBatch . mockResolvedValue ( {
171155 '0x456' : [ mockUser ]
172156 } ) ;
@@ -275,7 +259,9 @@ describe('VotingReminderTriggerHandler', () => {
275259 . mockRejectedValueOnce ( new Error ( 'Network error' ) )
276260 . mockResolvedValueOnce ( [ '0x456' ] ) ;
277261
278- mockAnticaptureClient . listVotesOnchains . mockResolvedValue ( [ ] ) ;
262+ mockAnticaptureClient . getProposalNonVoters . mockResolvedValue ( [
263+ { voter : '0x456' }
264+ ] ) ;
279265 mockSubscriptionClient . getWalletOwnersBatch . mockResolvedValue ( {
280266 '0x456' : [ mockUser ]
281267 } ) ;
0 commit comments