Add unit tests for player configurations and referral system

- Implement tests for player configuration creation, update, and deletion, ensuring proper handling of free and paid user scenarios.
- Add tests for referral registration, including valid and invalid referrer cases.
- Create tests for referral reward flow, verifying correct reward distribution and eligibility.
- Establish a test database setup with necessary schema for user, plan, payment, and notification models.
- Introduce helper functions for seeding test data and loading entities from the database.
This commit is contained in:
2026-03-26 02:20:05 +07:00
parent bb7f7b0bb3
commit 4de6baee61
25 changed files with 152 additions and 245 deletions

View File

@@ -1,7 +1,5 @@
package domain
import "time"
type JobStatus string
const (
@@ -11,28 +9,3 @@ const (
JobStatusFailure JobStatus = "failure"
JobStatusCancelled JobStatus = "cancelled"
)
type Job struct {
ID string `json:"id" gorm:"primaryKey;type:uuid;default:gen_random_uuid()"`
Status JobStatus `json:"status" gorm:"type:varchar(32);index"`
Priority int `json:"priority" gorm:"default:0;index"`
UserID string `json:"user_id" gorm:"index"`
VideoID string `json:"video_id,omitempty"`
Name string `json:"name"`
TimeLimit int64 `json:"time_limit"`
InputURL string `json:"input_url"`
OutputURL string `json:"output_url"`
TotalDuration int64 `json:"total_duration"`
CurrentTime int64 `json:"current_time"`
Progress float64 `json:"progress"`
AgentID *string `json:"agent_id" gorm:"type:uuid;index"`
Logs string `json:"logs" gorm:"type:text"`
Config string `json:"config" gorm:"type:text"`
Cancelled bool `json:"cancelled" gorm:"default:false"`
RetryCount int `json:"retry_count" gorm:"default:0"`
MaxRetries int `json:"max_retries" gorm:"default:3"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
func (Job) TableName() string { return "render_jobs" }