fix: refine mini program nickname collection flow
This commit is contained in:
@@ -253,6 +253,7 @@ pub struct WechatMiniProgramLoginResponse {
|
||||
pub token: String,
|
||||
pub binding_status: String,
|
||||
pub user: AuthUserPayload,
|
||||
pub created: bool,
|
||||
}
|
||||
|
||||
pub fn build_available_login_methods(
|
||||
@@ -389,4 +390,29 @@ mod tests {
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn wechat_mini_program_login_response_marks_created_user() {
|
||||
let payload = serde_json::to_value(WechatMiniProgramLoginResponse {
|
||||
token: "token-001".to_string(),
|
||||
binding_status: AUTH_BINDING_STATUS_PENDING_BIND_PHONE.to_string(),
|
||||
user: AuthUserPayload {
|
||||
id: "user_001".to_string(),
|
||||
public_user_code: "SY-00000001".to_string(),
|
||||
display_name: "微信旅人".to_string(),
|
||||
avatar_url: None,
|
||||
phone_number: None,
|
||||
phone_number_masked: None,
|
||||
login_method: AUTH_LOGIN_METHOD_WECHAT.to_string(),
|
||||
binding_status: AUTH_BINDING_STATUS_PENDING_BIND_PHONE.to_string(),
|
||||
wechat_bound: true,
|
||||
wechat_display_name: None,
|
||||
wechat_account: Some("wx-openid-001".to_string()),
|
||||
},
|
||||
created: true,
|
||||
})
|
||||
.expect("payload should serialize");
|
||||
|
||||
assert_eq!(payload["created"], serde_json::Value::Bool(true));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user