feat(example): add public API end-to-end flow
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
use wip_host::CallErrorKind;
|
||||
use wip_protocol::{OperationOutcome, ProtocolErrorCategory};
|
||||
use wip_public_api_example::{PublishOutcome, run};
|
||||
|
||||
#[test]
|
||||
fn public_crates_support_the_complete_end_to_end_scenario() {
|
||||
let report = run().unwrap();
|
||||
|
||||
assert_eq!(report.published_interfaces.len(), 2);
|
||||
assert_eq!(report.catalog_descriptor, report.published_interfaces[0]);
|
||||
assert_eq!(report.audit_descriptor, report.published_interfaces[1]);
|
||||
assert_eq!(
|
||||
report.published,
|
||||
PublishOutcome::Published("article-1".into())
|
||||
);
|
||||
assert_eq!(
|
||||
report.rejected,
|
||||
PublishOutcome::Rejected("a title is required".into())
|
||||
);
|
||||
assert_eq!(report.catalog_status, "catalog-ready");
|
||||
assert_eq!(report.audit_status, "audit-ready");
|
||||
assert_eq!(report.host_failure, CallErrorKind::Implementation);
|
||||
assert!(matches!(
|
||||
report.protocol_failure.outcome,
|
||||
OperationOutcome::Failed(error) if error.category == ProtocolErrorCategory::Internal
|
||||
));
|
||||
}
|
||||
Reference in New Issue
Block a user