- 1413
"semantic_type": "chart", - 1414
"payload": { - 1415
"title": "Revenue", - 1416
"chart_type": "line", - 1417
"accessible_summary": "flat", - 1418
"series": [{"name": "s1", "points": [{"x": 1, "y": 2.0}]}] - 1419
} - 1420
}); - 1421
let info = presentation_info("emit_chart_card", &args, &skills) - 1422
.expect("a valid call must rebuild"); - 1423
assert_eq!(info.semantic_type, "chart"); - 1424
assert_eq!(info.title, "Revenue"); - 1425
assert!( - 1426
info.identity_digest.contains("s1(1)"), - 1427
"{}", - 1428
info.identity_digest - 1429
); - 1430
assert!(info.schema_version > 0); - 1431
assert!(!info.skill_id.is_empty()); - 1432
} - 1433
- 1434
#[test] - 1435
fn presentation_info_is_none_for_an_invalid_call() { - 1436
let skills = vak_delivery::built_in_skill_registry(); - 1437
let args = serde_json::json!({"semantic_type": "chart", "payload": {"series": []}}); - 1438
assert!(presentation_info("emit_chart_card", &args, &skills).is_none()); - 1439
} - 1440
} - 1441
source · Rust
Presentation Tools
crates/vak-core/src/presentation_tools.rs55.4 KB1,441 lines11 anchorsSnapshot ed4ab258