@@ -31,24 +31,53 @@ defmodule Algora.BountiesTest do
31
31
creator = insert! ( :user )
32
32
owner = insert! ( :user )
33
33
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 )
35
37
_identity = insert! ( :identity , user: creator , provider_email: creator . email )
36
38
repo = insert! ( :repository , % { user: owner } )
37
39
ticket = insert! ( :ticket , % { repository: repo } )
38
40
amount = ~M[ 4000] usd
39
41
42
+ ticket_ref = % {
43
+ owner: owner . handle ,
44
+ repo: repo . name ,
45
+ number: ticket . number
46
+ }
47
+
40
48
bounty_params =
41
49
% {
42
- ticket_ref: % { owner: owner . handle , repo: repo . name , number: ticket . number } ,
50
+ ticket_ref: ticket_ref ,
43
51
owner: owner ,
44
52
creator: creator ,
45
53
amount: amount
46
54
}
47
55
48
56
assert { :ok , bounty } = Algora.Bounties . create_bounty ( bounty_params , [ ] )
49
57
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
+ )
52
81
53
82
assert_activity_names ( [ :bounty_posted , :tip_awarded ] )
54
83
assert_activity_names_for_user ( creator . id , [ :bounty_posted , :tip_awarded ] )
@@ -92,8 +121,8 @@ defmodule Algora.BountiesTest do
92
121
status: :open
93
122
)
94
123
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()
97
126
assert Algora.Bounties.PrizePool . list ( )
98
127
end
99
128
end
0 commit comments