Add skill for gameplay entry type workflows
This commit is contained in:
@@ -448,6 +448,81 @@ mod tests {
|
||||
RuntimeProfileWalletLedgerSourceType::AssetOperationRefund.as_str(),
|
||||
"asset_operation_refund"
|
||||
);
|
||||
assert_eq!(
|
||||
RuntimeProfileWalletLedgerSourceType::DailyTaskReward.as_str(),
|
||||
"daily_task_reward"
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn runtime_profile_beijing_day_key_uses_business_day_boundary() {
|
||||
let before_beijing_midnight = 1_714_927_999_999_999;
|
||||
let after_beijing_midnight = 1_714_928_000_000_000;
|
||||
|
||||
assert_eq!(
|
||||
runtime_profile_beijing_day_key(before_beijing_midnight),
|
||||
runtime_profile_beijing_day_key(after_beijing_midnight) - 1
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn runtime_profile_task_status_matches_progress_and_claim() {
|
||||
assert_eq!(
|
||||
resolve_runtime_profile_task_status(false, 1, 1, false),
|
||||
RuntimeProfileTaskStatus::Disabled
|
||||
);
|
||||
assert_eq!(
|
||||
resolve_runtime_profile_task_status(true, 0, 1, false),
|
||||
RuntimeProfileTaskStatus::Incomplete
|
||||
);
|
||||
assert_eq!(
|
||||
resolve_runtime_profile_task_status(true, 1, 1, false),
|
||||
RuntimeProfileTaskStatus::Claimable
|
||||
);
|
||||
assert_eq!(
|
||||
resolve_runtime_profile_task_status(true, 1, 1, true),
|
||||
RuntimeProfileTaskStatus::Claimed
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn build_task_config_input_rejects_invalid_reward_and_threshold() {
|
||||
assert_eq!(
|
||||
build_runtime_profile_task_config_admin_upsert_input(
|
||||
"admin".to_string(),
|
||||
PROFILE_TASK_ID_DAILY_LOGIN.to_string(),
|
||||
"每日登录".to_string(),
|
||||
"".to_string(),
|
||||
PROFILE_TASK_EVENT_KEY_DAILY_LOGIN.to_string(),
|
||||
RuntimeProfileTaskCycle::Daily,
|
||||
RuntimeTrackingScopeKind::User,
|
||||
0,
|
||||
10,
|
||||
true,
|
||||
10,
|
||||
1,
|
||||
)
|
||||
.expect_err("zero threshold should fail"),
|
||||
RuntimeProfileFieldError::InvalidTaskThreshold
|
||||
);
|
||||
assert_eq!(
|
||||
build_runtime_profile_task_config_admin_upsert_input(
|
||||
"admin".to_string(),
|
||||
PROFILE_TASK_ID_DAILY_LOGIN.to_string(),
|
||||
"每日登录".to_string(),
|
||||
"".to_string(),
|
||||
PROFILE_TASK_EVENT_KEY_DAILY_LOGIN.to_string(),
|
||||
RuntimeProfileTaskCycle::Daily,
|
||||
RuntimeTrackingScopeKind::User,
|
||||
1,
|
||||
0,
|
||||
true,
|
||||
10,
|
||||
1,
|
||||
)
|
||||
.expect_err("zero reward should fail"),
|
||||
RuntimeProfileFieldError::InvalidTaskReward
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
Reference in New Issue
Block a user