Skip to content

Commit

Permalink
Update the capabilities response for the example.
Browse files Browse the repository at this point in the history
  • Loading branch information
SamirTalwar committed Jun 4, 2024
1 parent f7bb836 commit 63b6ee4
Showing 1 changed file with 28 additions and 1 deletion.
29 changes: 28 additions & 1 deletion crates/sdk/src/connector/example.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ impl Connector for Example {

async fn get_capabilities() -> JsonResponse<models::CapabilitiesResponse> {
models::CapabilitiesResponse {
version: "0.1.3".into(),
version: "0.1.4".into(),
capabilities: models::Capabilities {
relationships: None,
query: models::QueryCapabilities {
Expand Down Expand Up @@ -122,3 +122,30 @@ impl Connector for Example {
todo!()
}
}

#[cfg(test)]
mod tests {
use std::error::Error;
use std::path::PathBuf;

use axum_test_helper::TestClient;
use http::StatusCode;

use super::*;

#[tokio::test]
async fn capabilities_match_ndc_spec_version() -> Result<(), Box<dyn Error + Send + Sync>> {
let state =
crate::default_main::init_server_state(Example::default(), PathBuf::new()).await?;
let app = crate::default_main::create_router::<Example>(state, None);

let client = TestClient::new(app);
let response = client.get("/capabilities").send().await;

assert_eq!(response.status(), StatusCode::OK);

let body: ndc_models::CapabilitiesResponse = response.json().await;
assert_eq!(body.version, ndc_models::VERSION);
Ok(())
}
}

0 comments on commit 63b6ee4

Please sign in to comment.