Skip to content

Commit

Permalink
test the thing
Browse files Browse the repository at this point in the history
  • Loading branch information
gastonfournier committed Nov 30, 2023
1 parent eddefae commit 0f8306f
Showing 1 changed file with 31 additions and 25 deletions.
56 changes: 31 additions & 25 deletions server/src/client_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1005,31 +1005,27 @@ mod tests {
let features = ClientFeatures {
version: 2,
query: None,
features: vec![
ClientFeature {
name: "edge-flag-1".into(),
feature_type: None,
dependencies: None,
description: None,
created_at: None,
last_seen_at: None,
enabled: true,
stale: None,
impression_data: None,
project: Some("default".into()),
strategies: Some(vec![
Strategy {
name: "gradualRollout".to_string(),
sort_order: None,
segments: None,
variants: None,
constraints: None,
parameters: None,
},
]),
features: vec![ClientFeature {
name: "edge-flag-1".into(),
feature_type: None,
dependencies: None,
description: None,
created_at: None,
last_seen_at: None,
enabled: true,
stale: None,
impression_data: None,
project: Some("default".into()),
strategies: Some(vec![Strategy {
name: "gradualRollout".to_string(),
sort_order: None,
segments: None,
variants: None,
},
],
constraints: None,
parameters: None,
}]),
variants: None,
}],
segments: None,
};

Expand All @@ -1056,6 +1052,16 @@ mod tests {
.to_request();
let result: ClientFeatures = test::call_and_read_body_json(&local_app, request).await;
assert_eq!(result.features.len(), 1);
assert!(result.features.get(0).unwrap().strategies.as_ref().unwrap().get(0).unwrap().variants.is_some());
assert!(result
.features
.get(0)
.unwrap()
.strategies
.as_ref()
.unwrap()
.get(0)
.unwrap()
.variants
.is_some());
}
}

0 comments on commit 0f8306f

Please sign in to comment.