Download codex-rs/app-server-protocol/src/protocol/common_tests.rs from SaylorTwift/codex: direct link, hf CLI and curl.
- Browser
- Download file 1.17 kB
-
https://huggingface.co/SaylorTwift/codex/resolve/main/codex-rs/app-server-protocol/src/protocol/common_tests.rs
- Command line
-
hf download hf://SaylorTwift/codex/codex-rs/app-server-protocol/src/protocol/common_tests.rs
-
curl -L -o common_tests.rs https://huggingface.co/SaylorTwift/codex/resolve/main/codex-rs/app-server-protocol/src/protocol/common_tests.rs
1.17 kB
| use super::*; | |
| use anyhow::Result; | |
| use codex_protocol::protocol::TurnAbortReason; | |
| use pretty_assertions::assert_eq; | |
| use serde_json::json; | |
| fn client_response_payload_serializes_without_an_intermediate_json_value() -> Result<()> { | |
| let payload = ClientResponsePayload::ThreadArchive(v2::ThreadArchiveResponse {}); | |
| assert_eq!(serde_json::to_string(&payload)?, "{}"); | |
| let Some(ClientResponse::ThreadArchive { | |
| request_id, | |
| response: _, | |
| }) = payload.into_client_response(RequestId::Integer(7)) | |
| else { | |
| panic!("expected thread/archive client response"); | |
| }; | |
| assert_eq!(request_id, RequestId::Integer(7)); | |
| Ok(()) | |
| } | |
| fn interrupt_conversation_payload_stays_jsonrpc_only() -> Result<()> { | |
| let payload = ClientResponsePayload::InterruptConversation(v1::InterruptConversationResponse { | |
| abort_reason: TurnAbortReason::Interrupted, | |
| }); | |
| assert_eq!( | |
| serde_json::to_value(&payload)?, | |
| json!({ | |
| "abortReason": "interrupted", | |
| }) | |
| ); | |
| assert!( | |
| payload | |
| .into_client_response(RequestId::Integer(8)) | |
| .is_none() | |
| ); | |
| Ok(()) | |
| } | |