test: enhance service test coverage and add audit tests

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
2026-02-04 14:58:12 +08:00
parent 33ad8c544e
commit bc9e5d9293
4 changed files with 168 additions and 14 deletions

View File

@@ -159,12 +159,15 @@ func (s *SuperTestSuite) Test_CreateTenant() {
So(t.UserID, ShouldEqual, u.ID)
So(t.Status, ShouldEqual, consts.TenantStatusVerified)
So(t.ExpiredAt.After(startAt), ShouldBeTrue)
So(t.ExpiredAt.Before(startAt.AddDate(0, 0, 8)), ShouldBeTrue)
So(t.ExpiredAt.After(startAt.AddDate(0, 0, 6)), ShouldBeTrue)
tu, _ := models.TenantUserQuery.WithContext(ctx).
Where(models.TenantUserQuery.TenantID.Eq(t.ID), models.TenantUserQuery.UserID.Eq(u.ID)).
First()
So(tu, ShouldNotBeNil)
So(tu.Status, ShouldEqual, consts.UserStatusVerified)
So(tu.Role, ShouldResemble, types.Array[consts.TenantUserRole]{consts.TenantUserRoleTenantAdmin})
})
})
}
@@ -1361,6 +1364,12 @@ func (s *SuperTestSuite) Test_PayoutAccountCreateUpdate() {
So(updated.ReviewedBy, ShouldEqual, int64(0))
So(updated.ReviewReason, ShouldEqual, "")
})
Convey("should get creator settings", func() {
res, err := Super.GetCreatorSettings(ctx, tenant.ID)
So(err, ShouldBeNil)
So(res.Name, ShouldEqual, "Payout Tenant 2")
})
})
}