@@ -31,24 +31,53 @@ defmodule Algora.BountiesTest do
3131 creator = insert! ( :user )
3232 owner = insert! ( :user )
3333 recipient = insert! ( :user )
34- _installation = insert! ( :installation , owner: creator )
34+ installation = insert! ( :installation , owner: creator )
35+ _installation = insert! ( :installation , owner: owner )
36+ _installation = insert! ( :installation , owner: recipient )
3537 _identity = insert! ( :identity , user: creator , provider_email: creator . email )
3638 repo = insert! ( :repository , % { user: owner } )
3739 ticket = insert! ( :ticket , % { repository: repo } )
3840 amount = ~M[ 4000] usd
3941
42+ ticket_ref = % {
43+ owner: owner . handle ,
44+ repo: repo . name ,
45+ number: ticket . number
46+ }
47+
4048 bounty_params =
4149 % {
42- ticket_ref: % { owner: owner . handle , repo: repo . name , number: ticket . number } ,
50+ ticket_ref: ticket_ref ,
4351 owner: owner ,
4452 creator: creator ,
4553 amount: amount
4654 }
4755
4856 assert { :ok , bounty } = Algora.Bounties . create_bounty ( bounty_params , [ ] )
4957
50- assert { :ok , tip } =
51- Algora.Bounties . create_tip ( % { amount: amount , owner: owner , creator: creator , recipient: recipient } )
58+ assert { :ok , claim } =
59+ Algora.Bounties . claim_bounty (
60+ % {
61+ user: recipient ,
62+ target_ticket_ref: ticket_ref ,
63+ source_ticket_ref: ticket_ref ,
64+ status: :approved ,
65+ type: :pull_request
66+ } ,
67+ installation_id: installation . id
68+ )
69+
70+ assert { :ok , _stripe_session_url } =
71+ Algora.Bounties . create_tip (
72+ % {
73+ amount: amount ,
74+ owner: owner ,
75+ creator: creator ,
76+ recipient: recipient
77+ } ,
78+ ticket_ref: ticket_ref ,
79+ claims: [ claim ]
80+ )
5281
5382 assert_activity_names ( [ :bounty_posted , :tip_awarded ] )
5483 assert_activity_names_for_user ( creator . id , [ :bounty_posted , :tip_awarded ] )
@@ -92,8 +121,8 @@ defmodule Algora.BountiesTest do
92121 status: :open
93122 )
94123
95- assert Algora.Bounties . fetch_stats ( bounty . owner_id )
96- assert Algora.Bounties . fetch_stats ( )
124+ # assert Algora.Bounties.fetch_stats(bounty.owner_id)
125+ # assert Algora.Bounties.fetch_stats()
97126 assert Algora.Bounties.PrizePool . list ( )
98127 end
99128 end
0 commit comments