Skip to content

Commit ad8f832

Browse files
Merge pull request #158 from Screenly/test/null_title_test
Adds: test for detecting title null difference.
2 parents b945358 + ddab417 commit ad8f832

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

src/commands/edge_app/utils.rs

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -395,6 +395,40 @@ mod tests {
395395
assert_eq!(changes.creates.len(), 0);
396396
}
397397

398+
#[test]
399+
fn test_detect_changed_settings_when_title_is_null_remotely_should_detect_changes() {
400+
let manifest = create_manifest();
401+
402+
let remote_settings = vec![
403+
Setting {
404+
name: "display_time".to_string(),
405+
type_: SettingType::String,
406+
default_value: Some("5".to_string()),
407+
title: None,
408+
optional: true,
409+
is_global: false,
410+
help_text: "For how long to display the map overlay every time the rover has moved to a new position.".to_string(),
411+
},
412+
Setting {
413+
name: "google_maps_api_key".to_string(),
414+
type_: SettingType::String,
415+
default_value: Some("6".to_string()),
416+
title: Some("Google maps title".to_string()),
417+
optional: true,
418+
is_global: false,
419+
help_text: "Specify a commercial Google Maps API key. Required due to the app's map feature.".to_string(),
420+
},
421+
];
422+
423+
// Act
424+
let result = detect_changed_settings(&manifest, &remote_settings);
425+
426+
// Assert
427+
assert!(result.is_ok());
428+
let changes = result.unwrap();
429+
assert_eq!(changes.updates.len(), 1);
430+
}
431+
398432
#[test]
399433
fn test_detect_changes_settings_when_setting_removed_should_detect_deleted_changes() {
400434
// Arrange

0 commit comments

Comments
 (0)