enhance(router): change MAX_ID_LENGTH to 64 (#792)

This commit is contained in:
Abhishek
2023-03-24 12:57:57 +05:30
committed by GitHub
parent a3c0033910
commit 346bd95445
2 changed files with 4 additions and 3 deletions

View File

@ -1,6 +1,6 @@
// ID generation
pub(crate) const ID_LENGTH: usize = 20;
pub(crate) const MAX_ID_LENGTH: usize = 24;
pub(crate) const MAX_ID_LENGTH: usize = 64;
#[rustfmt::skip]
pub(crate) const ALPHABETS: [char; 62] = [
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9',

View File

@ -126,7 +126,8 @@ mod tests {
#[test]
fn validate_id_length_constraint() {
let payment_id = "abcdefghijlkmnopqrstuvwzyzabcdefghijknlmnop".to_string(); //length = 43
let payment_id =
"abcdefghijlkmnopqrstuvwzyzabcdefghijknlmnopsjkdnfjsknfkjsdnfspoig".to_string(); //length = 65
let result = validate_id(payment_id, "payment_id");
assert!(result.is_err());
@ -134,7 +135,7 @@ mod tests {
#[test]
fn validate_id_proper_response() {
let payment_id = "abcdefghijlkmnopqrst".to_string();
let payment_id = "abcdefghijlkmnopqrstjhbjhjhkhbhgcxdfxvmhb".to_string();
let result = validate_id(payment_id.clone(), "payment_id");
assert!(result.is_ok());