From 3ef3ba100317baa71944e1c66089e883a3ec67da Mon Sep 17 00:00:00 2001 From: LZS911 <932177767@qq.com> Date: Thu, 28 Nov 2024 17:58:06 +0800 Subject: [PATCH] [test]:(DataSourceComparison) Add unit tests --- .../__snapshots__/index.test.tsx.snap | 98 + .../components/BasicTreeSelect/index.test.tsx | 95 + .../lib/components/BasicTreeSelect/index.tsx | 2 +- .../__tests__/ComparisonTreeNode.test.tsx | 222 +++ .../__tests__/ModifedSqlAuditResult.test.tsx | 249 +++ .../__tests__/ModifiedSqlDrawer.test.tsx | 122 ++ .../__tests__/SqlAuditResult.test.tsx | 98 + .../__tests__/TreeNode.test.tsx | 366 ++++ .../ComparisonTreeNode.test.tsx.snap | 1545 +++++++++++++++ .../ModifedSqlAuditResult.test.tsx.snap | 1659 +++++++++++++++++ .../ModifiedSqlDrawer.test.tsx.snap | 3 + .../SqlAuditResult.test.tsx.snap | 221 +++ .../__snapshots__/index.test.tsx.snap | 226 +++ .../useComparisonResultTree.test.tsx.snap | 427 +++++ .../useDataSourceSelectorTree.test.tsx.snap | 123 ++ .../ComparisonEntry/__tests__/index.test.tsx | 226 +++ .../useComparisonResultTree.test.tsx | 377 ++++ .../useDataSourceSelectorTree.test.tsx | 144 ++ .../ComparisonDetailDrawer/index.tsx | 18 +- .../component/ComparisonTreeNode/index.tsx | 2 +- .../component/EnvironmentSelector/index.tsx | 5 +- .../ModifiedSqlAuditResult/index.tsx | 2 +- .../component/SqlAuditResult/index.tsx | 2 +- .../hooks/useDataSourceSelectorTree.tsx | 11 +- .../ComparisonEntry/index.tsx | 1 - .../ComparisonEntry/utils/TreeNode.tsx | 16 +- .../__snapshots__/index.ce.test.tsx.snap | 1202 ++++++++++++ .../__snapshots__/index.test.tsx.snap | 21 + .../__tests__/index.ce.test.tsx | 14 + .../__tests__/index.test.tsx | 9 + ...FormValuesWithGenModifiedSqlParams.test.ts | 219 +++ .../mockApi/database_comparison/data.ts | 284 +++ .../mockApi/database_comparison/index.ts | 43 + 33 files changed, 8020 insertions(+), 32 deletions(-) create mode 100644 packages/shared/lib/components/BasicTreeSelect/__snapshots__/index.test.tsx.snap create mode 100644 packages/shared/lib/components/BasicTreeSelect/index.test.tsx create mode 100644 packages/sqle/src/page/DataSourceComparison/ComparisonEntry/__tests__/ComparisonTreeNode.test.tsx create mode 100644 packages/sqle/src/page/DataSourceComparison/ComparisonEntry/__tests__/ModifedSqlAuditResult.test.tsx create mode 100644 packages/sqle/src/page/DataSourceComparison/ComparisonEntry/__tests__/ModifiedSqlDrawer.test.tsx create mode 100644 packages/sqle/src/page/DataSourceComparison/ComparisonEntry/__tests__/SqlAuditResult.test.tsx create mode 100644 packages/sqle/src/page/DataSourceComparison/ComparisonEntry/__tests__/TreeNode.test.tsx create mode 100644 packages/sqle/src/page/DataSourceComparison/ComparisonEntry/__tests__/__snapshots__/ComparisonTreeNode.test.tsx.snap create mode 100644 packages/sqle/src/page/DataSourceComparison/ComparisonEntry/__tests__/__snapshots__/ModifedSqlAuditResult.test.tsx.snap create mode 100644 packages/sqle/src/page/DataSourceComparison/ComparisonEntry/__tests__/__snapshots__/ModifiedSqlDrawer.test.tsx.snap create mode 100644 packages/sqle/src/page/DataSourceComparison/ComparisonEntry/__tests__/__snapshots__/SqlAuditResult.test.tsx.snap create mode 100644 packages/sqle/src/page/DataSourceComparison/ComparisonEntry/__tests__/__snapshots__/index.test.tsx.snap create mode 100644 packages/sqle/src/page/DataSourceComparison/ComparisonEntry/__tests__/__snapshots__/useComparisonResultTree.test.tsx.snap create mode 100644 packages/sqle/src/page/DataSourceComparison/ComparisonEntry/__tests__/__snapshots__/useDataSourceSelectorTree.test.tsx.snap create mode 100644 packages/sqle/src/page/DataSourceComparison/ComparisonEntry/__tests__/index.test.tsx create mode 100644 packages/sqle/src/page/DataSourceComparison/ComparisonEntry/__tests__/useComparisonResultTree.test.tsx create mode 100644 packages/sqle/src/page/DataSourceComparison/ComparisonEntry/__tests__/useDataSourceSelectorTree.test.tsx create mode 100644 packages/sqle/src/page/DataSourceComparison/__tests__/__snapshots__/index.ce.test.tsx.snap create mode 100644 packages/sqle/src/page/DataSourceComparison/__tests__/__snapshots__/index.test.tsx.snap create mode 100644 packages/sqle/src/page/DataSourceComparison/__tests__/index.ce.test.tsx create mode 100644 packages/sqle/src/page/DataSourceComparison/__tests__/index.test.tsx create mode 100644 packages/sqle/src/page/SqlExecWorkflow/Create/components/FormStep/SqlAuditInfoForm/SqlAuditInfoFormItem/DatabaseSelectionItems/__tests__/useSetFormValuesWithGenModifiedSqlParams.test.ts create mode 100644 packages/sqle/src/testUtils/mockApi/database_comparison/data.ts create mode 100644 packages/sqle/src/testUtils/mockApi/database_comparison/index.ts diff --git a/packages/shared/lib/components/BasicTreeSelect/__snapshots__/index.test.tsx.snap b/packages/shared/lib/components/BasicTreeSelect/__snapshots__/index.test.tsx.snap new file mode 100644 index 000000000..938c5c74e --- /dev/null +++ b/packages/shared/lib/components/BasicTreeSelect/__snapshots__/index.test.tsx.snap @@ -0,0 +1,98 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`BasicTreeSelect should render the not found content when loading is true 1`] = ` +
+
+
+
+ 1
+
+ USE sqle;
+
+
+
+ 2
+
+
+
+
+
+
+
+
+ 1
+
+
+ DROP
+
+
+
+ TABLE
+
+ \`audit_files\`;
+
+
+
+ 2
+
+
+
+
+
+
+
+
+ 1
+
+
+ DROP
+
+
+
+ TABLE
+
+ \`audit_plan_report_sqls_v2\`;
+
+
+
+ 2
+
+
+
+
+
+
+
+
+ 1
+
+ USE sqle;
+
+
+
+ 2
+
+
+
+
+
+
+
+
+ 1
+
+
+ DROP
+
+
+
+ TABLE
+
+ \`audit_files\`;
+
+
+
+ 2
+
+
+
+
+
+
+
+
+ 1
+
+
+ DROP
+
+
+
+ TABLE
+
+ \`audit_plan_report_sqls_v2\`;
+
+
+
+ 2
+
+
+
+
+
+
+
+
+ 1
+
+ USE sqle;
+
+
+
+ 2
+
+
+
+
+
+
+
+
+ 1
+
+
+ DROP
+
+
+
+ TABLE
+
+ \`audit_files\`;
+
+
+
+ 2
+
+
+
+
+
+
+
+
+ 1
+
+
+ DROP
+
+
+
+ TABLE
+
+ \`audit_plan_report_sqls_v2\`;
+
+
+
+ 2
+
+
+
+
+ + 结构对比为企业版功能。如您想使用该功能,可以通过以下链接联系我们。 +
+ ++ 如您想了解更多关于企业版及社区版功能的差异,可参考用户手册 +
+ +