()
| 1122 | |
| 1123 | #[test] |
| 1124 | fn generates_document() { |
| 1125 | let descriptor = test_descriptor(); |
| 1126 | let sources = vec![DescriptorSource::new( |
| 1127 | &descriptor, |
| 1128 | vec![ServiceConfig::new("TestService", "/prpc")], |
| 1129 | )]; |
| 1130 | let info = DocumentInfo::new("Test API", "1.0.0") |
| 1131 | .with_description("test-only spec") |
| 1132 | .add_server("http://localhost:8000/prpc"); |
| 1133 | let json = generate_document(&sources, &info).expect("spec"); |
| 1134 | let doc: Value = serde_json::from_str(&json).expect("valid json"); |
| 1135 | assert_eq!(doc["info"]["title"], "Test API"); |
| 1136 | assert!( |
| 1137 | doc["paths"]["/prpc/Ping"]["post"]["requestBody"]["content"]["application/json"] |
| 1138 | ["schema"] |
| 1139 | .is_object() |
| 1140 | ); |
| 1141 | } |
| 1142 | } |
nothing calls this directly
no test coverage detected