The great storkit name conversion
This commit is contained in:
@@ -555,7 +555,10 @@ mod tests {
|
||||
match req {
|
||||
WsRequest::Chat { messages, config } => {
|
||||
assert!(messages.is_empty());
|
||||
assert_eq!(config.base_url.as_deref(), Some("https://api.anthropic.com"));
|
||||
assert_eq!(
|
||||
config.base_url.as_deref(),
|
||||
Some("https://api.anthropic.com")
|
||||
);
|
||||
assert_eq!(config.enable_tools, Some(true));
|
||||
assert_eq!(config.session_id.as_deref(), Some("sess-123"));
|
||||
}
|
||||
@@ -719,14 +722,14 @@ mod tests {
|
||||
stage: "2_current".to_string(),
|
||||
item_id: "42_story_foo".to_string(),
|
||||
action: "start".to_string(),
|
||||
commit_msg: "story-kit: start 42_story_foo".to_string(),
|
||||
commit_msg: "storkit: start 42_story_foo".to_string(),
|
||||
};
|
||||
let json = serde_json::to_value(&resp).unwrap();
|
||||
assert_eq!(json["type"], "work_item_changed");
|
||||
assert_eq!(json["stage"], "2_current");
|
||||
assert_eq!(json["item_id"], "42_story_foo");
|
||||
assert_eq!(json["action"], "start");
|
||||
assert_eq!(json["commit_msg"], "story-kit: start 42_story_foo");
|
||||
assert_eq!(json["commit_msg"], "storkit: start 42_story_foo");
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -847,7 +850,7 @@ mod tests {
|
||||
stage: "2_current".to_string(),
|
||||
item_id: "42_story_foo".to_string(),
|
||||
action: "start".to_string(),
|
||||
commit_msg: "story-kit: start 42_story_foo".to_string(),
|
||||
commit_msg: "storkit: start 42_story_foo".to_string(),
|
||||
};
|
||||
let ws_msg: Option<WsResponse> = evt.into();
|
||||
let ws_msg = ws_msg.expect("WorkItem should produce Some");
|
||||
@@ -1126,9 +1129,7 @@ mod tests {
|
||||
|
||||
tokio::spawn(async move {
|
||||
let acceptor = poem::listener::TcpAcceptor::from_tokio(listener).unwrap();
|
||||
let _ = poem::Server::new_with_acceptor(acceptor)
|
||||
.run(app)
|
||||
.await;
|
||||
let _ = poem::Server::new_with_acceptor(acceptor).run(app).await;
|
||||
});
|
||||
|
||||
// Small delay to let the server start.
|
||||
@@ -1256,17 +1257,12 @@ mod tests {
|
||||
let (mut sink, mut stream, _initial) = connect_ws(&url).await;
|
||||
|
||||
// Send invalid JSON.
|
||||
sink.send(ws_text("not valid json"))
|
||||
.await
|
||||
.unwrap();
|
||||
sink.send(ws_text("not valid json")).await.unwrap();
|
||||
|
||||
let msg = next_msg(&mut stream).await;
|
||||
assert_eq!(msg["type"], "error");
|
||||
assert!(
|
||||
msg["message"]
|
||||
.as_str()
|
||||
.unwrap()
|
||||
.contains("Invalid request"),
|
||||
msg["message"].as_str().unwrap().contains("Invalid request"),
|
||||
"error message should indicate invalid request, got: {}",
|
||||
msg["message"]
|
||||
);
|
||||
@@ -1278,9 +1274,7 @@ mod tests {
|
||||
let (mut sink, mut stream, _initial) = connect_ws(&url).await;
|
||||
|
||||
// Send a message with an unknown type.
|
||||
sink.send(ws_text(r#"{"type": "bogus"}"#))
|
||||
.await
|
||||
.unwrap();
|
||||
sink.send(ws_text(r#"{"type": "bogus"}"#)).await.unwrap();
|
||||
|
||||
let msg = next_msg(&mut stream).await;
|
||||
assert_eq!(msg["type"], "error");
|
||||
@@ -1293,14 +1287,10 @@ mod tests {
|
||||
let (mut sink, mut stream, _initial) = connect_ws(&url).await;
|
||||
|
||||
// Send cancel when no chat is active — should not produce an error.
|
||||
sink.send(ws_text(r#"{"type": "cancel"}"#))
|
||||
.await
|
||||
.unwrap();
|
||||
sink.send(ws_text(r#"{"type": "cancel"}"#)).await.unwrap();
|
||||
|
||||
// Send another invalid message to check the connection is still alive.
|
||||
sink.send(ws_text("{}"))
|
||||
.await
|
||||
.unwrap();
|
||||
sink.send(ws_text("{}")).await.unwrap();
|
||||
|
||||
let msg = next_msg(&mut stream).await;
|
||||
// The invalid JSON message should produce an error, confirming
|
||||
@@ -1321,9 +1311,7 @@ mod tests {
|
||||
.unwrap();
|
||||
|
||||
// Send a probe message to check the connection is still alive.
|
||||
sink.send(ws_text("bad"))
|
||||
.await
|
||||
.unwrap();
|
||||
sink.send(ws_text("bad")).await.unwrap();
|
||||
|
||||
let msg = next_msg(&mut stream).await;
|
||||
assert_eq!(msg["type"], "error");
|
||||
@@ -1341,7 +1329,7 @@ mod tests {
|
||||
stage: "2_current".to_string(),
|
||||
item_id: "99_story_test".to_string(),
|
||||
action: "start".to_string(),
|
||||
commit_msg: "story-kit: start 99_story_test".to_string(),
|
||||
commit_msg: "storkit: start 99_story_test".to_string(),
|
||||
})
|
||||
.unwrap();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user