mirror of
https://github.com/openai/codex.git
synced 2026-10-18 17:18:52 +00:00
Test text stringify errors in the code mode runtime (#39505)
## What changed Move circular-value coverage for the `text()` helper from the core integration suite to the in-process code mode runtime tests. Verify that stringification returns no content and surfaces the V8 circular-structure error without needing a mock server or network access. GitOrigin-RevId: d506591af5ae8ce0a8c7305d633a7b0f2e458335
This commit is contained in:
@@ -937,6 +937,47 @@ text(JSON.stringify(returnsUndefined));
|
||||
);
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn text_helper_surfaces_stringify_errors() {
|
||||
let service = InProcessCodeModeSession::new();
|
||||
|
||||
let response = execute(
|
||||
&service,
|
||||
ExecuteRequest {
|
||||
source: r#"
|
||||
const circular = {};
|
||||
circular.self = circular;
|
||||
text(circular);
|
||||
"#
|
||||
.to_string(),
|
||||
yield_time_ms: None,
|
||||
..execute_request("")
|
||||
},
|
||||
)
|
||||
.await;
|
||||
|
||||
let RuntimeResponse::Result {
|
||||
error_text: Some(error_text),
|
||||
..
|
||||
} = &response
|
||||
else {
|
||||
panic!("circular stringify unexpectedly succeeded: {response:?}");
|
||||
};
|
||||
assert!(
|
||||
error_text.contains("Converting circular structure to JSON"),
|
||||
"unexpected circular stringify error: {error_text}"
|
||||
);
|
||||
let error_text = error_text.clone();
|
||||
assert_eq!(
|
||||
response,
|
||||
RuntimeResponse::Result {
|
||||
cell_id: cell_id("1"),
|
||||
content_items: Vec::new(),
|
||||
error_text: Some(error_text),
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn audio_helper_accepts_audio_url_object_and_raw_mcp_audio_block() {
|
||||
let service = InProcessCodeModeSession::new();
|
||||
|
||||
Reference in New Issue
Block a user