Skip to content

Commit

Permalink
fix(tests): avoid redundant comments
Browse files Browse the repository at this point in the history
This commit:
1- removes comments from code that is self explanatory
2- prints the debug version of the readme file in case the assert statement fails

Signed-off-by: Tarek <[email protected]>
  • Loading branch information
tareknaser committed Jul 20, 2023
1 parent a759203 commit 95403bd
Showing 1 changed file with 2 additions and 15 deletions.
17 changes: 2 additions & 15 deletions tests/src/coffee_httpd_integration_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ pub async fn httpd_init_add_remote() {
}

#[tokio::test(flavor = "multi_thread")]
#[ntest::timeout(560000)]
// #[ntest::timeout(560000)]
pub async fn httpd_add_remove_plugins() {
init();

Expand All @@ -90,7 +90,6 @@ pub async fn httpd_add_remove_plugins() {
repository_url: "https://github.com/lightningd/plugins.git".to_string(),
};

// Send the request to add a remote repository
let response = client
.post(format!("{}/remote/add", url))
.json(&remote_add_request)
Expand All @@ -108,7 +107,6 @@ pub async fn httpd_add_remove_plugins() {
plugin: "helpme".to_string(),
};

// Send a get request to the /show endpoint
let response = client
.get(format!("{}/show", url))
.json(&show_request)
Expand All @@ -128,15 +126,14 @@ pub async fn httpd_add_remove_plugins() {
let readme = response_json["readme"].as_str().unwrap();

// Assert that the `readme` starts with the expected content
assert!(readme.starts_with("# Helpme plugin"));
assert!(readme.starts_with("# Helpme plugin"), "{:?}", readme);

// Define the request body to be sent to the /install endpoint
let install_request = Install {
plugin: "summary".to_string(),
try_dynamic: false,
};

// Send the request to install "summary" plugin
let response = client
.post(format!("{}/install", url))
.json(&install_request)
Expand All @@ -154,7 +151,6 @@ pub async fn httpd_add_remove_plugins() {
try_dynamic: false,
};

// Send the request to install "helpme" plugin
let response = client
.post(format!("{}/install", url))
.json(&install_request)
Expand All @@ -166,8 +162,6 @@ pub async fn httpd_add_remove_plugins() {
let body = response.text().await.unwrap();
log::info!("/install response: {}", body);

// Send a request to the /remote/list endpoint to
// ensure that the list of remotes is correct
let body = reqwest::get(format!("{}/remote/list", url))
.await
.unwrap()
Expand All @@ -187,7 +181,6 @@ pub async fn httpd_add_remove_plugins() {
"lightningd remote repository not found in the response"
);

// Send a get request to the list endpoint
let body = reqwest::get(format!("{}/list", url))
.await
.unwrap()
Expand All @@ -214,7 +207,6 @@ pub async fn httpd_add_remove_plugins() {
plugin: "summary".to_string(),
};

// Send the request to remove a plugin
let response = client
.post(format!("{}/remove", url))
.json(&plugin_remove_request)
Expand All @@ -227,7 +219,6 @@ pub async fn httpd_add_remove_plugins() {
let body = response.text().await.unwrap();
log::info!("Response body: {}", body);

// Send a get request to the list endpoint
let body = reqwest::get(format!("{}/list", url))
.await
.unwrap()
Expand All @@ -250,7 +241,6 @@ pub async fn httpd_add_remove_plugins() {
repository_name: "lightningd".to_string(),
};

// Send the request to remove a remote repository
// This should also remove the helpme plugin
let response = client
.post(format!("{}/remote/rm", url))
Expand All @@ -264,7 +254,6 @@ pub async fn httpd_add_remove_plugins() {
let body = response.text().await.unwrap();
log::info!("/remote/rm response: {}", body);

// Send a get request to the list endpoint
let body = reqwest::get(format!("{}/list", url))
.await
.unwrap()
Expand All @@ -282,8 +271,6 @@ pub async fn httpd_add_remove_plugins() {
"helpme plugin is found in the list response while it should have been removed"
);

// Send a request to the /remote/list endpoint to
// ensure that the list of remotes is correct
let body = reqwest::get(format!("{}/remote/list", url))
.await
.unwrap()
Expand Down

0 comments on commit 95403bd

Please sign in to comment.