Skip to content

Commit

Permalink
chore: update test
Browse files Browse the repository at this point in the history
  • Loading branch information
appflowy committed Jan 5, 2025
1 parent 8aa17ac commit d610483
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 30 deletions.
40 changes: 11 additions & 29 deletions tests/ai_test/chat_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use crate::ai_test::util::read_text_from_asset;
use appflowy_ai_client::dto::{
ChatQuestionQuery, OutputContent, OutputContentMetadata, OutputLayout, ResponseFormat,
};
use assert_json_diff::{assert_json_eq, assert_json_include};
use assert_json_diff::assert_json_include;
use client_api::entity::{QuestionStream, QuestionStreamValue};
use client_api_test::{ai_test_enabled, TestClient};
use futures_util::StreamExt;
Expand Down Expand Up @@ -223,35 +223,17 @@ async fn chat_qa_test() {
.create_question(&workspace_id, &chat_id, params)
.await
.unwrap();
assert_json_include!(
actual: question.meta_data,
expected: json!([
{
"id": "123",
"name": "test context",
"source": "user added",
"extra": {
"created_at": 123
}
}
])
);

let answer = test_client
.api_client
.get_answer(&workspace_id, &chat_id, question.message_id)
.await
.unwrap();
assert!(answer.content.contains("Singapore"));
assert_json_eq!(
answer.meta_data,
json!([
{
"id": "123",
"name": "test context",
"source": "user added",
let expected = json!({
"id": "123",
"name": "test context",
"source": "user added",
"extra": {
"created_at": 123
}
])
});
assert_json_include!(
actual: json!(question.meta_data[0]),
expected: expected
);

let related_questions = test_client
Expand Down
2 changes: 1 addition & 1 deletion tests/collab/stress_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ async fn stress_test_run_multiple_text_edits() {
));
// create writer
let mut writer = TestClient::new_user().await;
sleep(Duration::from_secs(2)).await; // sleep 2 secs to make sure it do not trigger register user too fast in gotrue
sleep(Duration::from_secs(5)).await; // sleep 5 secs to make sure it do not trigger register user too fast in gotrue

let object_id = Uuid::new_v4().to_string();
let workspace_id = writer.workspace_id().await;
Expand Down

0 comments on commit d610483

Please sign in to comment.