Skip to content

Commit

Permalink
Adds: test for detecting title null difference.
Browse files Browse the repository at this point in the history
  • Loading branch information
korvyashka committed Mar 25, 2024
1 parent 425420f commit 4953e13
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions src/commands/edge_app_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,40 @@ mod tests {
assert_eq!(changes.updates[0].default_value, Some("6".to_owned()));
}

#[test]
fn test_detect_changed_settings_when_title_is_null_remotely_should_detect_changes() {
let manifest = create_manifest();

let remote_settings = vec![
Setting {
name: "display_time".to_string(),
type_: SettingType::String,
default_value: Some("5".to_string()),
title: None,
optional: true,
is_global: false,
help_text: "For how long to display the map overlay every time the rover has moved to a new position.".to_string(),
},
Setting {
name: "google_maps_api_key".to_string(),
type_: SettingType::String,
default_value: Some("6".to_string()),
title: Some("Google maps title".to_string()),
optional: true,
is_global: false,
help_text: "Specify a commercial Google Maps API key. Required due to the app's map feature.".to_string(),
},
];

// Act
let result = detect_changed_settings(&manifest, &remote_settings);

// Assert
assert!(result.is_ok());
let changes = result.unwrap();
assert_eq!(changes.updates.len(), 1);
}

#[test]
fn test_detect_changed_settings_when_no_remote_settings_should_detect_changes() {
// Arrange
Expand Down

0 comments on commit 4953e13

Please sign in to comment.