File size: 1,523 Bytes
17f328f | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 | use codex_plugin::AppConnectorId;
use codex_plugin::AppDeclaration;
use pretty_assertions::assert_eq;
use super::parse_plugin_app_config;
#[test]
fn parses_plugin_app_config_in_order_without_validating_connector_ids() {
let parsed = parse_plugin_app_config(
r#"{
"apps": {
"calendar": {
"id": "connector_calendar",
"category": " productivity "
},
"drive": {
"id": "connector_calendar",
"category": " "
},
"blank": {
"id": " "
}
}
}"#,
)
.expect("plugin app config should parse");
assert_eq!(
parsed,
vec![
AppDeclaration {
name: "calendar".to_string(),
connector_id: AppConnectorId("connector_calendar".to_string()),
category: Some("productivity".to_string()),
},
AppDeclaration {
name: "drive".to_string(),
connector_id: AppConnectorId("connector_calendar".to_string()),
category: None,
},
AppDeclaration {
name: "blank".to_string(),
connector_id: AppConnectorId(" ".to_string()),
category: None,
},
]
);
}
#[test]
fn rejects_invalid_plugin_app_config() {
assert!(parse_plugin_app_config("not json").is_err());
}
|