-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added some initial integration tests
- Loading branch information
Showing
5 changed files
with
186 additions
and
1 deletion.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,3 +31,6 @@ pretty_env_logger = "0.5" | |
|
||
[profile.dev.package."*"] | ||
opt-level = 3 | ||
|
||
[dev-dependencies] | ||
axum-test = "14" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
mod llm; | ||
mod routes; | ||
pub mod routes; | ||
use log::info; | ||
use tokio::net::TcpListener; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
use axum_test::{TestServer, TestServerConfig}; | ||
use rust_slackbot_llm::routes::create_routes; | ||
use serde_json::Value; | ||
|
||
async fn new_test_app() -> TestServer { | ||
let app = create_routes().await.unwrap(); | ||
let config = TestServerConfig::builder() | ||
.expect_success_by_default() | ||
.mock_transport() | ||
.build(); | ||
|
||
TestServer::new_with_config(app, config).unwrap() | ||
} | ||
|
||
#[tokio::test] | ||
async fn test_index() { | ||
let server = new_test_app().await; | ||
|
||
let response = server.get("/v1").await; | ||
|
||
assert_eq!(response.status_code(), 200); | ||
let expected_response: Value = "Welcome to the Rust Slackbot LLM API!".into(); | ||
response.assert_json(&expected_response); | ||
} |