Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: calculation UI refresh #6615

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions frontend/rust-lib/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 18 additions & 0 deletions frontend/rust-lib/event-integration-test/src/database_event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,24 @@ impl EventIntegrationTest {
.error()
}

pub async fn remove_calculate(&self, changeset: RemoveCalculationChangesetPB) {
// #[event(input = "RemoveCalculationChangesetPB")]
// RemoveCalculation = 165,
todo!()
}

pub async fn get_all_calculations(&self) -> RepeatedCalculationsPB {
// #[event(input = "DatabaseViewIdPB", output = "RepeatedCalculationsPB")]
// GetAllCalculations = 163,
todo!()
}

pub async fn update_calculation(&self, changeset: UpdateCalculationChangesetPB) {
// #[event(input = "UpdateCalculationChangesetPB")]
// UpdateCalculation = 164,
todo!()
}

pub async fn update_field_type(
&self,
view_id: &str,
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1 +1,17 @@
use crate::util::gen_csv_import_data;
use event_integration_test::user_event::use_localhost_af_cloud;
use event_integration_test::EventIntegrationTest;

#[tokio::test]
async fn calculation_integration_test1() {
use_localhost_af_cloud().await;
let test = EventIntegrationTest::new().await;
test.sign_up_as_anon().await;

let workspace_id = test.get_current_workspace().await.id;
let payload = gen_csv_import_data("project&task", &workspace_id);
let view = test.import_data(payload).await.pop().unwrap();
test.open_database(&view.id).await;

// create calculation tests here
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ async fn af_cloud_edit_document_test() {

#[tokio::test]
async fn af_cloud_sync_anon_user_document_test() {
let (cleaner, user_db_path) = unzip("./tests/asset", "040_sync_local_document").unwrap();
let user_db_path = unzip("./tests/asset", "040_sync_local_document").unwrap();
use_localhost_af_cloud().await;
let test =
EventIntegrationTest::new_with_user_data_path(user_db_path.clone(), DEFAULT_NAME.to_string())
Expand Down Expand Up @@ -77,8 +77,6 @@ async fn af_cloud_sync_anon_user_document_test() {
&document_id,
expected_040_sync_local_document_data(),
);

drop(cleaner);
}

fn expected_040_sync_local_document_data() -> DocumentData {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use flowy_folder::entities::{ImportPayloadPB, ImportTypePB, ImportValuePayloadPB
async fn import_492_row_csv_file_test() {
// csv_500r_15c.csv is a file with 492 rows and 17 columns
let file_name = "csv_492r_17c.csv".to_string();
let (cleaner, csv_file_path) = unzip("./tests/asset", &file_name).unwrap();
let csv_file_path = unzip("./tests/asset", &file_name).unwrap();

let csv_string = std::fs::read_to_string(csv_file_path).unwrap();
let test = EventIntegrationTest::new_with_name(DEFAULT_NAME).await;
Expand All @@ -20,14 +20,13 @@ async fn import_492_row_csv_file_test() {
let view_id = views[0].clone().id;
let database = test.get_database(&view_id).await;
assert_eq!(database.rows.len(), 492);
drop(cleaner);
}

#[tokio::test]
async fn import_10240_row_csv_file_test() {
// csv_22577r_15c.csv is a file with 10240 rows and 15 columns
let file_name = "csv_10240r_15c.csv".to_string();
let (cleaner, csv_file_path) = unzip("./tests/asset", &file_name).unwrap();
let csv_file_path = unzip("./tests/asset", &file_name).unwrap();

let csv_string = std::fs::read_to_string(csv_file_path).unwrap();
let test = EventIntegrationTest::new_with_name(DEFAULT_NAME).await;
Expand All @@ -40,8 +39,6 @@ async fn import_10240_row_csv_file_test() {
let view_id = views[0].clone().id;
let database = test.get_database(&view_id).await;
assert_eq!(database.rows.len(), 10240);

drop(cleaner);
}

fn gen_import_data(file_name: String, csv_string: String, workspace_id: String) -> ImportPayloadPB {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,23 +121,21 @@ async fn test_publish_encode_collab_result(
}

async fn import_workspace(file_name: &str, test: &EventIntegrationTest) -> Vec<ViewPB> {
let (cleaner, file_path) = unzip("./tests/asset", file_name).unwrap();
let file_path = unzip("./tests/asset", file_name).unwrap();
test
.import_appflowy_data(file_path.to_str().unwrap().to_string(), None)
.await
.unwrap();
let views = test.get_all_workspace_views().await;
drop(cleaner);
views
}

async fn import_csv(file_name: &str, test: &EventIntegrationTest) -> ViewPB {
let (cleaner, file_path) = unzip("./tests/asset", file_name).unwrap();
let file_path = unzip("./tests/asset", file_name).unwrap();
let csv_string = std::fs::read_to_string(file_path).unwrap();
let workspace_id = test.get_current_workspace().await.id;
let import_data = gen_import_data(file_name.to_string(), csv_string, workspace_id);
let views = test.import_data(import_data).await;
drop(cleaner);
views[0].clone()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use crate::util::unzip;

#[tokio::test]
async fn reading_039_anon_user_data_test() {
let (cleaner, user_db_path) = unzip("./tests/asset", "039_local").unwrap();
let user_db_path = unzip("./tests/asset", "039_local").unwrap();
let test =
EventIntegrationTest::new_with_user_data_path(user_db_path, DEFAULT_NAME.to_string()).await;
let first_level_views = test.get_all_workspace_views().await;
Expand Down Expand Up @@ -36,13 +36,11 @@ async fn reading_039_anon_user_data_test() {

let trash_items = test.get_trash().await.items;
assert_eq!(trash_items.len(), 1);

drop(cleaner);
}

#[tokio::test]
async fn migrate_anon_user_data_to_af_cloud_test() {
let (cleaner, user_db_path) = unzip("./tests/asset", "040_local").unwrap();
let user_db_path = unzip("./tests/asset", "040_local").unwrap();
// In the 040_local, the structure is:
// workspace:
// view: Document1
Expand Down Expand Up @@ -113,6 +111,4 @@ async fn migrate_anon_user_data_to_af_cloud_test() {
assert_eq!(anon_third_level_views.len(), 2);
assert_eq!(user_third_level_views[0].name, "Grid1".to_string());
assert_eq!(user_third_level_views[1].name, "Grid2".to_string());

drop(cleaner);
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use std::env::temp_dir;
#[tokio::test]
async fn import_appflowy_data_with_ref_views_test() {
let import_container_name = "data_ref_doc".to_string();
let (_cleaner, user_db_path) = unzip("./tests/asset", &import_container_name).unwrap();
let user_db_path = unzip("./tests/asset", &import_container_name).unwrap();
use_localhost_af_cloud().await;
let test = EventIntegrationTest::new_with_name(DEFAULT_NAME).await;
let _ = test.af_cloud_sign_up().await;
Expand Down Expand Up @@ -98,7 +98,7 @@ async fn import_appflowy_data_with_ref_views_test() {
#[tokio::test]
async fn import_appflowy_data_folder_into_new_view_test() {
let import_container_name = "040_local".to_string();
let (cleaner, user_db_path) = unzip("./tests/asset", &import_container_name).unwrap();
let user_db_path = unzip("./tests/asset", &import_container_name).unwrap();
// In the 040_local, the structure is:
// Document1
// Document2
Expand Down Expand Up @@ -173,13 +173,12 @@ async fn import_appflowy_data_folder_into_new_view_test() {

let row_document_data = test.get_document_data(&row_document_id).await;
assert_json_include!(actual: json!(row_document_data), expected: expected_row_doc_json());
drop(cleaner);
}

#[tokio::test]
async fn import_appflowy_data_folder_into_current_workspace_test() {
let import_container_name = "040_local".to_string();
let (cleaner, user_db_path) = unzip("./tests/asset", &import_container_name).unwrap();
let user_db_path = unzip("./tests/asset", &import_container_name).unwrap();
// In the 040_local, the structure is:
// Document1
// Document2
Expand Down Expand Up @@ -224,8 +223,6 @@ async fn import_appflowy_data_folder_into_current_workspace_test() {
assert_eq!(document2_child_views.len(), 2);
assert_eq!(document2_child_views[0].name, "Grid1");
assert_eq!(document2_child_views[1].name, "Grid2");

drop(cleaner);
}

#[tokio::test]
Expand All @@ -247,7 +244,7 @@ async fn import_empty_appflowy_data_folder_test() {
#[tokio::test]
async fn import_appflowy_data_folder_multiple_times_test() {
let import_container_name = "040_local_2".to_string();
let (cleaner, user_db_path) = unzip("./tests/asset", &import_container_name).unwrap();
let user_db_path = unzip("./tests/asset", &import_container_name).unwrap();
// In the 040_local_2, the structure is:
// Getting Started
// Doc1
Expand Down Expand Up @@ -313,7 +310,6 @@ async fn import_appflowy_data_folder_multiple_times_test() {
for view in shared_space_children_views {
assert_040_local_2_import_content(&test, &view.id).await;
}
drop(cleaner);
}

async fn assert_040_local_2_import_content(test: &EventIntegrationTest, view_id: &str) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@ use std::time::Duration;
#[tokio::test]
async fn import_appflowy_data_folder_into_new_view_test() {
let import_container_name = "040_local".to_string();
let (cleaner, user_db_path) = unzip("./tests/asset", &import_container_name).unwrap();
let (imported_af_folder_cleaner, imported_af_data_path) =
unzip("./tests/asset", &import_container_name).unwrap();
let user_db_path = unzip("./tests/asset", &import_container_name).unwrap();
let imported_af_data_path = unzip("./tests/asset", &import_container_name).unwrap();

use_localhost_af_cloud().await;
let test =
Expand Down Expand Up @@ -50,7 +49,4 @@ async fn import_appflowy_data_folder_into_new_view_test() {
assert_eq!(view.name, import_container_name);
}
}

drop(cleaner);
drop(imported_af_folder_cleaner);
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use crate::util::unzip;

#[tokio::test]
async fn migrate_historical_empty_document_test() {
let (cleaner, user_db_path) = unzip(
let user_db_path = unzip(
"./tests/user/migration_test/history_user_db",
"historical_empty_document",
)
Expand All @@ -23,6 +23,4 @@ async fn migrate_historical_empty_document_test() {
assert_eq!(data.blocks.len(), 2);
assert!(!data.meta.children_map.is_empty());
}

drop(cleaner);
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use crate::util::unzip;

#[tokio::test]
async fn migrate_020_historical_empty_document_test() {
let (cleaner, user_db_path) = unzip(
let user_db_path = unzip(
"./tests/user/migration_test/history_user_db",
"020_historical_user_data",
)
Expand Down Expand Up @@ -37,13 +37,12 @@ async fn migrate_020_historical_empty_document_test() {
let database = test.get_database(&child_views[1].id).await;
assert_eq!(database.fields.len(), 8);
assert_eq!(database.rows.len(), 3);
drop(cleaner);
}

#[tokio::test]
async fn migrate_036_fav_v1_workspace_array_test() {
// Used to test migration: FavoriteV1AndWorkspaceArrayMigration
let (cleaner, user_db_path) = unzip(
let user_db_path = unzip(
"./tests/user/migration_test/history_user_db",
"036_fav_v1_workspace_array",
)
Expand All @@ -59,13 +58,12 @@ async fn migrate_036_fav_v1_workspace_array_test() {
let views = test.get_view(&views[1].id).await;
assert_eq!(views.child_views.len(), 3);
assert!(views.child_views[2].is_favorite);
drop(cleaner);
}

#[tokio::test]
async fn migrate_038_trash_test() {
// Used to test migration: WorkspaceTrashMapToSectionMigration
let (cleaner, user_db_path) = unzip("./tests/asset", "038_local").unwrap();
let user_db_path = unzip("./tests/asset", "038_local").unwrap();
// Getting started
// Document1
// Document2(deleted)
Expand Down Expand Up @@ -95,14 +93,12 @@ async fn migrate_038_trash_test() {
assert_eq!(trash_items[0].name, "Document3");
assert_eq!(trash_items[1].name, "Document2");
assert_eq!(trash_items[2].name, "Document4");

drop(cleaner);
}

#[tokio::test]
async fn migrate_038_trash_test2() {
// Used to test migration: WorkspaceTrashMapToSectionMigration
let (cleaner, user_db_path) = unzip("./tests/asset", "038_document_with_grid").unwrap();
let user_db_path = unzip("./tests/asset", "038_document_with_grid").unwrap();
// Getting started
// document
// grid
Expand All @@ -123,14 +119,12 @@ async fn migrate_038_trash_test2() {

let views = test.get_view(&views[0].id).await.child_views;
assert_eq!(views[0].name, "board");

drop(cleaner);
}

#[tokio::test]
async fn collab_db_backup_test() {
// Used to test migration: WorkspaceTrashMapToSectionMigration
let (cleaner, user_db_path) = unzip("./tests/asset", "038_local").unwrap();
let user_db_path = unzip("./tests/asset", "038_local").unwrap();
let test =
EventIntegrationTest::new_with_user_data_path(user_db_path, DEFAULT_NAME.to_string()).await;

Expand All @@ -145,13 +139,12 @@ async fn collab_db_backup_test() {
backups[0],
format!("collab_db_{}", chrono::Local::now().format("%Y%m%d"))
);
drop(cleaner);
}

#[tokio::test]
async fn delete_outdated_collab_db_backup_test() {
// Used to test migration: WorkspaceTrashMapToSectionMigration
let (cleaner, user_db_path) = unzip("./tests/asset", "040_collab_backups").unwrap();
let user_db_path = unzip("./tests/asset", "040_collab_backups").unwrap();
let test =
EventIntegrationTest::new_with_user_data_path(user_db_path, DEFAULT_NAME.to_string()).await;

Expand Down Expand Up @@ -179,5 +172,4 @@ async fn delete_outdated_collab_db_backup_test() {
backups[9],
format!("collab_db_{}", chrono::Local::now().format("%Y%m%d"))
);
drop(cleaner);
}
Loading
Loading