Skip to content

Commit

Permalink
fix(project): removed useless tests and data (#5)
Browse files Browse the repository at this point in the history
Co-authored-by: Bread White <breadrock1@email.net>
  • Loading branch information
breadrock1 and Bread White authored Nov 5, 2024
1 parent 896c5b0 commit 65e43db
Showing 5 changed files with 2 additions and 14,497 deletions.
2 changes: 1 addition & 1 deletion src/crawler/llm/retriever.rs
Original file line number Diff line number Diff line change
@@ -31,7 +31,7 @@ pub fn extract_semantic_blocks(text_data: &str) -> Result<String, anyhow::Error>
.filter_map(|it| match extract_json_object(it.as_str()) {
Ok(data) => Some(data),
Err(err) => {
tracing::error!(err=?err, "failed while extracting json object");
tracing::warn!("failed while extracting json object: {err:#?}");
None
}
})
8,919 changes: 0 additions & 8,919 deletions tests/resources/cnn-news.html

This file was deleted.

5,562 changes: 0 additions & 5,562 deletions tests/resources/ndtv-news.html

This file was deleted.

1 change: 0 additions & 1 deletion tests/test_publish_feeds.rs
Original file line number Diff line number Diff line change
@@ -41,7 +41,6 @@ async fn test_rss_feeds() -> Result<(), anyhow::Error> {
.map(|it| {
let config = it.config();

let name = config.source_name();
let url = config.target_url();
let it_cln = it.clone();
let worker = tokio::spawn(async move { it_cln.launch_fetching().await });
15 changes: 1 addition & 14 deletions tests/tests_helper.rs
Original file line number Diff line number Diff line change
@@ -27,26 +27,14 @@ use wiremock::{Mock, MockServer, ResponseTemplate};
const TEST_AMQP_CONSUMER_TAG: &str = "test-news-rss-consumer";
pub const TEST_LLM_URL: &str = "/v1/chat/completions";
pub const TEST_NEWS_URL: &str = "/news/index.html";
pub const INPUT_HTML_DATA: &[u8] = include_bytes!("resources/cnn-news.html");
pub const INPUT_LLM_RESP_JSON_DATA: &str = include_str!("resources/llm-chat-response.json");

pub async fn build_mock_server() -> MockServer {
let mock_server = MockServer::start().await;
create_load_news_route(&mock_server, TEST_NEWS_URL, "GET").await;
create_llm_completion_route(&mock_server, TEST_LLM_URL, "POST").await;
mock_server
}

pub async fn create_load_news_route(mock: &MockServer, url: &str, http_method: &str) {
let resp_template = ResponseTemplate::new(200).set_body_bytes(INPUT_HTML_DATA);

Mock::given(method(http_method))
.and(path(url))
.respond_with(resp_template)
.mount(mock)
.await;
}

pub async fn create_llm_completion_route(mock: &MockServer, url: &str, http_method: &str) {
let resp_template = ResponseTemplate::new(200).set_body_string(INPUT_LLM_RESP_JSON_DATA);

@@ -103,8 +91,7 @@ pub async fn rabbit_consumer(config: &RabbitConfig) -> Result<(), anyhow::Error>
BasicConsumeOptions::default(),
FieldTable::default(),
)
.await
.unwrap();
.await?;

let mut counter = 0;
consumer.set_delegate(move |delivery: DeliveryResult| async move {

0 comments on commit 65e43db

Please sign in to comment.