Skip to content

Commit

Permalink
fix: bedrock tests (#915)
Browse files Browse the repository at this point in the history
  • Loading branch information
maxday authored Aug 12, 2024
1 parent 2cfef41 commit 6bbd1c1
Showing 1 changed file with 16 additions and 13 deletions.
29 changes: 16 additions & 13 deletions lambda-events/src/event/bedrock_agent_runtime/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,31 +82,34 @@ pub struct Agent {

#[cfg(test)]
mod tests {

use crate::event::bedrock_agent_runtime::AgentEvent;

#[test]
#[cfg(feature = "bedrock-agent-runtime")]
fn example_bedrock_agent__runtime_event() {
let data = include!("../../fixtures/example-bedrock-agent-runtime-event.json");
let parsed: AgentEvent = serde_json::from_str(&data).unwrap();
#[cfg(feature = "bedrock_agent_runtime")]
fn example_bedrock_agent_runtime_event() {
let data = include_bytes!("../../fixtures/example-bedrock-agent-runtime-event.json");
let parsed: AgentEvent = serde_json::from_slice(data).unwrap();
let output: String = serde_json::to_string(&parsed).unwrap();
let reparsed: AgentEvent = serde_json::from_slice(&output.as_bytes()).unwrap();
let reparsed: AgentEvent = serde_json::from_slice(output.as_bytes()).unwrap();
assert_eq!(parsed, reparsed);
}
#[test]
#[cfg(feature = "bedrock-agent-runtime")]
#[cfg(feature = "bedrock_agent_runtime")]
fn example_bedrock_agent_runtime_event_without_parameters() {
let data = include!("../../fixtures/example-bedrock-agent-runtime-event-without-parameters.json");
let parsed: AgentEvent = serde_json::from_str(&data).unwrap();
let data = include_bytes!("../../fixtures/example-bedrock-agent-runtime-event-without-parameters.json");
let parsed: AgentEvent = serde_json::from_slice(data).unwrap();
let output: String = serde_json::to_string(&parsed).unwrap();
let reparsed: AgentEvent = serde_json::from_slice(&output.as_bytes()).unwrap();
let reparsed: AgentEvent = serde_json::from_slice(output.as_bytes()).unwrap();
assert_eq!(parsed, reparsed);
}
#[test]
#[cfg(feature = "bedrock-agent-runtime")]
#[cfg(feature = "bedrock_agent_runtime")]
fn example_bedrock_agent_runtime_event_without_request_body() {
let data = include!("../../fixtures/example-bedrock-agent-runtime-event-without-request-body.json");
let parsed: AgentEvent = serde_json::from_str(&data).unwrap();
let data = include_bytes!("../../fixtures/example-bedrock-agent-runtime-event-without-request-body.json");
let parsed: AgentEvent = serde_json::from_slice(data).unwrap();
let output: String = serde_json::to_string(&parsed).unwrap();
let reparsed: AgentEvent = serde_json::from_slice(&output.as_bytes()).unwrap();
let reparsed: AgentEvent = serde_json::from_slice(output.as_bytes()).unwrap();
assert_eq!(parsed, reparsed);
}
}

0 comments on commit 6bbd1c1

Please sign in to comment.