@@ -171,6 +171,57 @@ describe("proposal", () => {
171171 } ) ;
172172 expect ( hasExpectedTransfers ( receipts , expected ) ) . toBe ( true ) ;
173173 } ) ;
174+
175+ it ( "sends withdraw notification after proposal execution" , async ( ) => {
176+ const [ withdraw , anotherWithdraw ] = proposals ;
177+ if ( ! withdraw || ! anotherWithdraw ) throw new Error ( "missing proposals" ) ;
178+ const sendPushNotification = vi . spyOn ( onesignal , "sendPushNotification" ) . mockResolvedValue ( { } ) ;
179+ vi . spyOn ( ensClient , "getEnsName" ) . mockResolvedValue ( "alice.eth" ) ;
180+ vi . spyOn ( publicClient , "readContract" ) . mockImplementation ( ( { functionName } ) => {
181+ if ( functionName === "decimals" ) return Promise . resolve ( 6 ) ;
182+ if ( functionName === "symbol" ) return Promise . resolve ( "exaUSDC" ) ;
183+ return Promise . reject ( new Error ( "unexpected readContract call" ) ) ;
184+ } ) ;
185+ const proposalExecutions = waitForSuccessfulProposalExecutions ( [ withdraw . args . nonce , anotherWithdraw . args . nonce ] ) ;
186+
187+ await Promise . all ( [
188+ appClient . index . $post ( {
189+ ...withdrawProposal ,
190+ json : {
191+ ...withdrawProposal . json ,
192+ event : {
193+ ...withdrawProposal . json . event ,
194+ data : {
195+ ...withdrawProposal . json . event . data ,
196+ block : {
197+ ...withdrawProposal . json . event . data . block ,
198+ logs : [
199+ { topics : withdraw . topics , data : withdraw . data , account : { address : withdraw . address } } ,
200+ {
201+ topics : anotherWithdraw . topics ,
202+ data : anotherWithdraw . data ,
203+ account : { address : anotherWithdraw . address } ,
204+ } ,
205+ ] ,
206+ } ,
207+ } ,
208+ } ,
209+ } ,
210+ } ) ,
211+ proposalExecutions ,
212+ ] ) ;
213+ await vi . waitUntil ( ( ) => sendPushNotification . mock . calls . length >= 2 , 26_666 ) ;
214+ expect ( sendPushNotification ) . toHaveBeenCalledWith ( {
215+ userId : bobAccount ,
216+ headings : { en : "Withdraw completed" , es : "Retiro completado" } , // cspell:ignore Retiro completado
217+ contents : { en : "3 USDC sent to alice.eth" , es : "3 USDC enviados a alice.eth" } , // cspell:ignore enviados
218+ } ) ;
219+ expect ( sendPushNotification ) . toHaveBeenCalledWith ( {
220+ userId : bobAccount ,
221+ headings : { en : "Withdraw completed" , es : "Retiro completado" } ,
222+ contents : { en : "4 USDC sent to alice.eth" , es : "4 USDC enviados a alice.eth" } ,
223+ } ) ;
224+ } ) ;
174225 } ) ;
175226
176227 describe ( "with weth withdraw proposal" , ( ) => {
0 commit comments