Skip to content

Commit 5cd5d87

Browse files
committed
fix merge issues
2 parents 8bda265 + 26dbeab commit 5cd5d87

9 files changed

Lines changed: 352 additions & 237 deletions

File tree

Cargo.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,7 @@ base64 = "0.22.1"
3333
# Disable the needless_return lint globally
3434
# Note: This key does not exist in clippy.toml directly, hence inline attributes are preferred.
3535

36+
[dev-dependencies]
37+
serial_test = "3.2.0"
38+
mockall = "0.12.1"
39+

src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ pub mod scenarios {
77
pub mod rfq_listen;
88
pub mod rfq_publish;
99
pub mod single_leg_order;
10+
#[cfg(test)]
11+
mod tests;
1012
}
1113
pub mod config;
1214
pub mod setup;

src/messages/utils/jwt_tests.rs

Lines changed: 12 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,30 @@
11
#[cfg(test)]
22
mod jwt_tests {
3-
use super::*;
43
use jwtk::ecdsa::EcdsaPrivateKey;
5-
4+
5+
use crate::messages::utils::{generate_access_token, generate_jwt};
6+
67
fn setup_test_key() -> EcdsaPrivateKey {
7-
// This would need a valid test key for actual testing
8-
// For now, we'll just create a placeholder that would be replaced with actual test keys
9-
let test_pem = "-----BEGIN EC PRIVATE KEY-----\nMHcCAQEEILULtd0+Rx4/vMF/cVZ/SYU6Fo/HlgQF==\n-----END EC PRIVATE KEY-----";
8+
let test_pem = "-----BEGIN EC PRIVATE KEY-----\nMHcCAQEEIFxrWIO1BpNTG1oiLRKc9fPHUuF3PHtx9RgNJAdZWhDBoAoGCCqGSM49\nAwEHoUQDQgAEdqr9eg/9hxsGwHatmOMyAQX2PfW1uj8RA4xKy3e4mUTO0+nUPlwl\n1ZqiYMy8ciFFRu6Jj7WDU/lVrqB1HvnCgQ==\n-----END EC PRIVATE KEY-----";
109
EcdsaPrivateKey::from_pem(test_pem.as_bytes()).expect("Test key creation failed")
1110
}
12-
11+
1312
#[test]
1413
fn test_generate_jwt_structure() {
15-
// This test would verify the JWT has the correct structure
16-
// Would need proper test keys to actually run
17-
/*
1814
let key = setup_test_key();
1915
let api_key = "test_api_key".to_string();
2016
let now = 1234567890;
2117
let uri = "wss://test.example.com".to_string();
22-
2318
let token = generate_jwt(api_key.clone(), now, uri.clone(), key);
24-
25-
// Verify token is not empty
2619
assert!(!token.is_empty());
27-
28-
// Verify token has three parts separated by dots
29-
let parts: Vec<&str> = token.split('.').collect();
30-
assert_eq!(parts.len(), 3);
31-
*/
20+
assert_eq!(token.split('.').count(), 3);
3221
}
33-
22+
3423
#[test]
3524
fn test_generate_access_token() {
36-
// Similar to above, would verify access token generation
37-
// Would need proper test keys
25+
let key = setup_test_key();
26+
let token = generate_access_token("api", key, "wss://example.com");
27+
assert!(!token.is_empty());
28+
assert_eq!(token.split('.').count(), 3);
3829
}
39-
}
30+
}

0 commit comments

Comments
 (0)