Skip to content

Commit 4953e13

Browse files
committed
Adds: test for detecting title null difference.
1 parent 425420f commit 4953e13

1 file changed

Lines changed: 34 additions & 0 deletions

File tree

src/commands/edge_app_utils.rs

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -357,6 +357,40 @@ mod tests {
357357
assert_eq!(changes.updates[0].default_value, Some("6".to_owned()));
358358
}
359359

360+
#[test]
361+
fn test_detect_changed_settings_when_title_is_null_remotely_should_detect_changes() {
362+
let manifest = create_manifest();
363+
364+
let remote_settings = vec![
365+
Setting {
366+
name: "display_time".to_string(),
367+
type_: SettingType::String,
368+
default_value: Some("5".to_string()),
369+
title: None,
370+
optional: true,
371+
is_global: false,
372+
help_text: "For how long to display the map overlay every time the rover has moved to a new position.".to_string(),
373+
},
374+
Setting {
375+
name: "google_maps_api_key".to_string(),
376+
type_: SettingType::String,
377+
default_value: Some("6".to_string()),
378+
title: Some("Google maps title".to_string()),
379+
optional: true,
380+
is_global: false,
381+
help_text: "Specify a commercial Google Maps API key. Required due to the app's map feature.".to_string(),
382+
},
383+
];
384+
385+
// Act
386+
let result = detect_changed_settings(&manifest, &remote_settings);
387+
388+
// Assert
389+
assert!(result.is_ok());
390+
let changes = result.unwrap();
391+
assert_eq!(changes.updates.len(), 1);
392+
}
393+
360394
#[test]
361395
fn test_detect_changed_settings_when_no_remote_settings_should_detect_changes() {
362396
// Arrange

0 commit comments

Comments
 (0)