File tree Expand file tree Collapse file tree 1 file changed +38
-0
lines changed
Expand file tree Collapse file tree 1 file changed +38
-0
lines changed Original file line number Diff line number Diff line change 11package launchpad
22
33import (
4+ "std"
45 "testing"
56
7+ "gno.land/p/demo/testutils"
68 "gno.land/p/demo/uassert"
79 "gno.land/p/demo/ufmt"
810 u256 "gno.land/p/gnoswap/uint256"
@@ -225,3 +227,39 @@ func TestCalculateTierRewards(t *testing.T) {
225227 })
226228 }
227229}
230+
231+ func TestCollectRewardByDepositId_FailCases(t *testing.T) {
232+ setup := func() {
233+ projects = make(map[string]Project)
234+ deposits = make(map[string]Deposit)
235+ depositsByUserByProject = make(map[std.Address]map[string][]string)
236+ }
237+
238+ t.Run("ID not found", func(t *testing.T) {
239+ setup()
240+
241+ defer func() {
242+ if r := recover(); r == nil {
243+ t.Error("expected panic but not")
244+ }
245+ }()
246+
247+ CollectRewardByDepositId("non_existent_id")
248+ })
249+
250+ t.Run("Claimable height before", func(t *testing.T) {
251+ setup()
252+
253+ projectId := "test_project"
254+ depositId := "test_deposit"
255+
256+ deposits[depositId] = Deposit{
257+ id: depositId,
258+ projectId: projectId,
259+ claimableHeight: uint64(std.GetHeight()) + 1000,
260+ }
261+
262+ reward := CollectRewardByDepositId(depositId)
263+ uassert.Equal(t, reward, uint64(0))
264+ })
265+ }
You can’t perform that action at this time.
0 commit comments