@datarecce/ui 0.1.30 → 0.1.31
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api.d.mts +1 -1
- package/dist/api.d.ts +1 -1
- package/dist/components.d.mts +1 -1
- package/dist/components.d.ts +1 -1
- package/dist/hooks.d.mts +1 -1
- package/dist/hooks.d.ts +1 -1
- package/dist/{index-BNUP2V_N.d.ts → index-B9lSPJTi.d.ts} +184 -2
- package/dist/index-B9lSPJTi.d.ts.map +1 -0
- package/dist/{index-DOPZuhD8.d.mts → index-IIXVIoOL.d.mts} +253 -71
- package/dist/index-IIXVIoOL.d.mts.map +1 -0
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +8 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +3 -2
- package/dist/index.mjs.map +1 -1
- package/dist/styles.css +4 -0
- package/dist/theme.d.mts +2 -185
- package/dist/theme.d.ts +2 -185
- package/dist/types.d.mts +1 -1
- package/dist/types.d.ts +1 -1
- package/package.json +4 -2
- package/recce-source/.editorconfig +26 -0
- package/recce-source/.flake8 +37 -0
- package/recce-source/.github/ISSUE_TEMPLATE/bug_report.yml +67 -0
- package/recce-source/.github/ISSUE_TEMPLATE/custom.md +10 -0
- package/recce-source/.github/ISSUE_TEMPLATE/feature_request.yml +42 -0
- package/recce-source/.github/PULL_REQUEST_TEMPLATE.md +21 -0
- package/recce-source/.github/copilot-instructions.md +331 -0
- package/recce-source/.github/instructions/backend-instructions.md +541 -0
- package/recce-source/.github/instructions/frontend-instructions.md +317 -0
- package/recce-source/.github/workflows/build-statics.yaml +72 -0
- package/recce-source/.github/workflows/bump.yaml +48 -0
- package/recce-source/.github/workflows/integration-tests-cloud.yaml +92 -0
- package/recce-source/.github/workflows/integration-tests-sqlmesh.yaml +33 -0
- package/recce-source/.github/workflows/integration-tests.yaml +52 -0
- package/recce-source/.github/workflows/nightly.yaml +246 -0
- package/recce-source/.github/workflows/release.yaml +196 -0
- package/recce-source/.github/workflows/tests-js.yaml +58 -0
- package/recce-source/.github/workflows/tests-python.yaml +128 -0
- package/recce-source/.pre-commit-config.yaml +26 -0
- package/recce-source/CLAUDE.md +483 -0
- package/recce-source/CODE_OF_CONDUCT.md +128 -0
- package/recce-source/CONTRIBUTING.md +107 -0
- package/recce-source/LICENSE +201 -0
- package/recce-source/Makefile +126 -0
- package/recce-source/README.md +182 -0
- package/recce-source/RECCE_CLOUD.md +81 -0
- package/recce-source/SECURITY.md +25 -0
- package/recce-source/docs/PACKAGING.md +340 -0
- package/recce-source/docs/README.md +1 -0
- package/recce-source/integration_tests/dbt/dbt_project.yml +26 -0
- package/recce-source/integration_tests/dbt/models/customers.sql +69 -0
- package/recce-source/integration_tests/dbt/models/docs.md +14 -0
- package/recce-source/integration_tests/dbt/models/orders.sql +56 -0
- package/recce-source/integration_tests/dbt/models/schema.yml +82 -0
- package/recce-source/integration_tests/dbt/models/staging/schema.yml +31 -0
- package/recce-source/integration_tests/dbt/models/staging/stg_customers.sql +22 -0
- package/recce-source/integration_tests/dbt/models/staging/stg_orders.sql +23 -0
- package/recce-source/integration_tests/dbt/models/staging/stg_payments.sql +25 -0
- package/recce-source/integration_tests/dbt/packages.yml +7 -0
- package/recce-source/integration_tests/dbt/profiles.yml +8 -0
- package/recce-source/integration_tests/dbt/seeds/raw_customers.csv +101 -0
- package/recce-source/integration_tests/dbt/seeds/raw_orders.csv +100 -0
- package/recce-source/integration_tests/dbt/seeds/raw_payments.csv +114 -0
- package/recce-source/integration_tests/dbt/seeds/raw_statuses.csv +5 -0
- package/recce-source/integration_tests/dbt/smoke_test.sh +72 -0
- package/recce-source/integration_tests/dbt/smoke_test_cloud.sh +71 -0
- package/recce-source/integration_tests/sqlmesh/__init__.py +0 -0
- package/recce-source/integration_tests/sqlmesh/audits/assert_item_price_above_zero.sql +9 -0
- package/recce-source/integration_tests/sqlmesh/audits/items.sql +7 -0
- package/recce-source/integration_tests/sqlmesh/audits/order_items.sql +7 -0
- package/recce-source/integration_tests/sqlmesh/config.py +171 -0
- package/recce-source/integration_tests/sqlmesh/helper.py +20 -0
- package/recce-source/integration_tests/sqlmesh/hooks/__init__.py +0 -0
- package/recce-source/integration_tests/sqlmesh/macros/__init__.py +0 -0
- package/recce-source/integration_tests/sqlmesh/macros/macros.py +8 -0
- package/recce-source/integration_tests/sqlmesh/macros/macros.sql +8 -0
- package/recce-source/integration_tests/sqlmesh/macros/utils.py +11 -0
- package/recce-source/integration_tests/sqlmesh/metrics/metrics.sql +25 -0
- package/recce-source/integration_tests/sqlmesh/models/customer_revenue_by_day.sql +41 -0
- package/recce-source/integration_tests/sqlmesh/models/customer_revenue_lifetime.sql +60 -0
- package/recce-source/integration_tests/sqlmesh/models/customers.sql +32 -0
- package/recce-source/integration_tests/sqlmesh/models/items.py +95 -0
- package/recce-source/integration_tests/sqlmesh/models/marketing.sql +15 -0
- package/recce-source/integration_tests/sqlmesh/models/order_items.py +95 -0
- package/recce-source/integration_tests/sqlmesh/models/orders.py +70 -0
- package/recce-source/integration_tests/sqlmesh/models/raw_marketing.py +62 -0
- package/recce-source/integration_tests/sqlmesh/models/top_waiters.sql +23 -0
- package/recce-source/integration_tests/sqlmesh/models/waiter_as_customer_by_day.sql +29 -0
- package/recce-source/integration_tests/sqlmesh/models/waiter_names.sql +10 -0
- package/recce-source/integration_tests/sqlmesh/models/waiter_revenue_by_day.sql +29 -0
- package/recce-source/integration_tests/sqlmesh/models/waiters.py +62 -0
- package/recce-source/integration_tests/sqlmesh/prep_env.sh +16 -0
- package/recce-source/integration_tests/sqlmesh/schema.yaml +5 -0
- package/recce-source/integration_tests/sqlmesh/seeds/waiter_names.csv +11 -0
- package/recce-source/integration_tests/sqlmesh/test_server.sh +29 -0
- package/recce-source/integration_tests/sqlmesh/tests/test_customer_revenue_by_day.yaml +63 -0
- package/recce-source/integration_tests/sqlmesh/tests/test_order_items.yaml +72 -0
- package/recce-source/js/.editorconfig +27 -0
- package/recce-source/js/.env.development +5 -0
- package/recce-source/js/.husky/pre-commit +29 -0
- package/recce-source/js/.nvmrc +1 -0
- package/recce-source/js/README.md +39 -0
- package/recce-source/js/app/(mainComponents)/DisplayModeToggle.tsx +65 -0
- package/recce-source/js/app/(mainComponents)/NavBar.tsx +228 -0
- package/recce-source/js/app/(mainComponents)/RecceVersionBadge.tsx +107 -0
- package/recce-source/js/app/(mainComponents)/TopBar.tsx +252 -0
- package/recce-source/js/app/@lineage/default.tsx +20 -0
- package/recce-source/js/app/@lineage/page.tsx +14 -0
- package/recce-source/js/app/MainLayout.tsx +170 -0
- package/recce-source/js/app/Providers.tsx +49 -0
- package/recce-source/js/app/checks/page.tsx +296 -0
- package/recce-source/js/app/error.tsx +93 -0
- package/recce-source/js/app/favicon.ico +0 -0
- package/recce-source/js/app/global-error.tsx +115 -0
- package/recce-source/js/app/global.css +82 -0
- package/recce-source/js/app/layout.tsx +48 -0
- package/recce-source/js/app/lineage/page.tsx +15 -0
- package/recce-source/js/app/page.tsx +12 -0
- package/recce-source/js/app/query/page.tsx +8 -0
- package/recce-source/js/biome.json +313 -0
- package/recce-source/js/jest.config.js +34 -0
- package/recce-source/js/jest.globals.d.ts +32 -0
- package/recce-source/js/jest.setup.js +91 -0
- package/recce-source/js/next.config.js +16 -0
- package/recce-source/js/package-lock.json +13843 -0
- package/recce-source/js/package.json +123 -0
- package/recce-source/js/pnpm-lock.yaml +9235 -0
- package/recce-source/js/pnpm-workspace.yaml +6 -0
- package/recce-source/js/postcss.config.js +5 -0
- package/recce-source/js/public/auth_callback.html +68 -0
- package/recce-source/js/public/imgs/feedback/thumbs-down.png +0 -0
- package/recce-source/js/public/imgs/feedback/thumbs-up.png +0 -0
- package/recce-source/js/public/imgs/reload-image.svg +4 -0
- package/recce-source/js/public/logo/recce-logo-white.png +0 -0
- package/recce-source/js/src/components/AuthModal/AuthModal.tsx +202 -0
- package/recce-source/js/src/components/app/AvatarDropdown.tsx +159 -0
- package/recce-source/js/src/components/app/EnvInfo.tsx +357 -0
- package/recce-source/js/src/components/app/Filename.tsx +388 -0
- package/recce-source/js/src/components/app/SetupConnectionPopover.tsx +91 -0
- package/recce-source/js/src/components/app/StateExporter.tsx +57 -0
- package/recce-source/js/src/components/app/StateImporter.tsx +198 -0
- package/recce-source/js/src/components/app/StateSharing.tsx +145 -0
- package/recce-source/js/src/components/app/StateSynchronizer.tsx +205 -0
- package/recce-source/js/src/components/charts/HistogramChart.tsx +291 -0
- package/recce-source/js/src/components/charts/SquareIcon.tsx +51 -0
- package/recce-source/js/src/components/charts/TopKSummaryList.tsx +457 -0
- package/recce-source/js/src/components/charts/chartTheme.ts +74 -0
- package/recce-source/js/src/components/check/CheckBreadcrumb.tsx +97 -0
- package/recce-source/js/src/components/check/CheckDescription.tsx +134 -0
- package/recce-source/js/src/components/check/CheckDetail.tsx +797 -0
- package/recce-source/js/src/components/check/CheckEmptyState.tsx +84 -0
- package/recce-source/js/src/components/check/CheckList.tsx +320 -0
- package/recce-source/js/src/components/check/LineageDiffView.tsx +32 -0
- package/recce-source/js/src/components/check/PresetCheckTemplateView.tsx +48 -0
- package/recce-source/js/src/components/check/SchemaDiffView.tsx +290 -0
- package/recce-source/js/src/components/check/check.ts +25 -0
- package/recce-source/js/src/components/check/timeline/CheckTimeline.tsx +163 -0
- package/recce-source/js/src/components/check/timeline/CommentInput.tsx +84 -0
- package/recce-source/js/src/components/check/timeline/TimelineEvent.tsx +468 -0
- package/recce-source/js/src/components/check/timeline/index.ts +12 -0
- package/recce-source/js/src/components/check/utils.ts +12 -0
- package/recce-source/js/src/components/data-grid/ScreenshotDataGrid.tsx +333 -0
- package/recce-source/js/src/components/data-grid/agGridStyles.css +55 -0
- package/recce-source/js/src/components/data-grid/agGridTheme.ts +43 -0
- package/recce-source/js/src/components/editor/CodeEditor.tsx +107 -0
- package/recce-source/js/src/components/editor/DiffEditor.tsx +162 -0
- package/recce-source/js/src/components/editor/index.ts +12 -0
- package/recce-source/js/src/components/errorboundary/ErrorBoundary.tsx +87 -0
- package/recce-source/js/src/components/histogram/HistogramDiffForm.tsx +147 -0
- package/recce-source/js/src/components/histogram/HistogramDiffResultView.tsx +63 -0
- package/recce-source/js/src/components/icons/index.tsx +142 -0
- package/recce-source/js/src/components/lineage/ActionControl.tsx +63 -0
- package/recce-source/js/src/components/lineage/ActionTag.tsx +141 -0
- package/recce-source/js/src/components/lineage/ChangeStatusLegend.tsx +46 -0
- package/recce-source/js/src/components/lineage/ColumnLevelLineageControl.tsx +327 -0
- package/recce-source/js/src/components/lineage/ColumnLevelLineageLegend.tsx +57 -0
- package/recce-source/js/src/components/lineage/GraphColumnNode.tsx +199 -0
- package/recce-source/js/src/components/lineage/GraphEdge.tsx +59 -0
- package/recce-source/js/src/components/lineage/GraphNode.tsx +555 -0
- package/recce-source/js/src/components/lineage/LineagePage.tsx +10 -0
- package/recce-source/js/src/components/lineage/LineageView.tsx +1384 -0
- package/recce-source/js/src/components/lineage/LineageViewContext.tsx +86 -0
- package/recce-source/js/src/components/lineage/LineageViewContextMenu.tsx +637 -0
- package/recce-source/js/src/components/lineage/LineageViewNotification.tsx +64 -0
- package/recce-source/js/src/components/lineage/LineageViewTopBar.tsx +596 -0
- package/recce-source/js/src/components/lineage/NodeSqlView.tsx +136 -0
- package/recce-source/js/src/components/lineage/NodeTag.tsx +278 -0
- package/recce-source/js/src/components/lineage/NodeView.tsx +642 -0
- package/recce-source/js/src/components/lineage/SandboxView.tsx +436 -0
- package/recce-source/js/src/components/lineage/ServerDisconnectedModalContent.tsx +105 -0
- package/recce-source/js/src/components/lineage/SetupConnectionBanner.tsx +52 -0
- package/recce-source/js/src/components/lineage/SingleEnvironmentQueryView.tsx +152 -0
- package/recce-source/js/src/components/lineage/graph.test.ts +31 -0
- package/recce-source/js/src/components/lineage/graph.ts +58 -0
- package/recce-source/js/src/components/lineage/lineage.test.ts +169 -0
- package/recce-source/js/src/components/lineage/lineage.ts +521 -0
- package/recce-source/js/src/components/lineage/styles.css +42 -0
- package/recce-source/js/src/components/lineage/styles.tsx +165 -0
- package/recce-source/js/src/components/lineage/useMultiNodesAction.ts +352 -0
- package/recce-source/js/src/components/lineage/useValueDiffAlertDialog.tsx +108 -0
- package/recce-source/js/src/components/onboarding-guide/Notification.tsx +62 -0
- package/recce-source/js/src/components/profile/ProfileDiffForm.tsx +134 -0
- package/recce-source/js/src/components/profile/ProfileDiffResultView.tsx +245 -0
- package/recce-source/js/src/components/query/ChangedOnlyCheckbox.tsx +29 -0
- package/recce-source/js/src/components/query/DiffText.tsx +120 -0
- package/recce-source/js/src/components/query/QueryDiffResultView.tsx +470 -0
- package/recce-source/js/src/components/query/QueryForm.tsx +80 -0
- package/recce-source/js/src/components/query/QueryPage.tsx +282 -0
- package/recce-source/js/src/components/query/QueryResultView.tsx +180 -0
- package/recce-source/js/src/components/query/SetupConnectionGuide.tsx +57 -0
- package/recce-source/js/src/components/query/SqlEditor.tsx +245 -0
- package/recce-source/js/src/components/query/ToggleSwitch.tsx +84 -0
- package/recce-source/js/src/components/query/styles.css +21 -0
- package/recce-source/js/src/components/routing/DirectUrlAccess.test.tsx +428 -0
- package/recce-source/js/src/components/routing/LineageStatePreservation.test.tsx +311 -0
- package/recce-source/js/src/components/routing/Navigation.test.tsx +256 -0
- package/recce-source/js/src/components/rowcount/RowCountDiffResultView.tsx +109 -0
- package/recce-source/js/src/components/rowcount/delta.ts +11 -0
- package/recce-source/js/src/components/run/RunList.tsx +303 -0
- package/recce-source/js/src/components/run/RunModal.tsx +191 -0
- package/recce-source/js/src/components/run/RunPage.tsx +26 -0
- package/recce-source/js/src/components/run/RunResultPane.tsx +454 -0
- package/recce-source/js/src/components/run/RunStatusAndDate.tsx +106 -0
- package/recce-source/js/src/components/run/RunToolbar.tsx +70 -0
- package/recce-source/js/src/components/run/RunView.tsx +196 -0
- package/recce-source/js/src/components/run/registry.ts +214 -0
- package/recce-source/js/src/components/run/types.ts +14 -0
- package/recce-source/js/src/components/schema/ColumnNameCell.test.tsx +169 -0
- package/recce-source/js/src/components/schema/ColumnNameCell.tsx +198 -0
- package/recce-source/js/src/components/schema/SchemaView.tsx +337 -0
- package/recce-source/js/src/components/schema/schemaDiff.ts +32 -0
- package/recce-source/js/src/components/schema/style.css +134 -0
- package/recce-source/js/src/components/screenshot/ScreenshotBox.tsx +39 -0
- package/recce-source/js/src/components/shared/HistoryToggle.tsx +35 -0
- package/recce-source/js/src/components/split/Split.tsx +40 -0
- package/recce-source/js/src/components/split/styles.css +24 -0
- package/recce-source/js/src/components/summary/ChangeSummary.tsx +264 -0
- package/recce-source/js/src/components/summary/SchemaSummary.tsx +123 -0
- package/recce-source/js/src/components/summary/SummaryView.tsx +29 -0
- package/recce-source/js/src/components/timeout/IdleTimeoutBadge.tsx +48 -0
- package/recce-source/js/src/components/top-k/TopKDiffForm.tsx +58 -0
- package/recce-source/js/src/components/top-k/TopKDiffResultView.tsx +73 -0
- package/recce-source/js/src/components/ui/dataGrid/DataFrameColumnGroupHeader.tsx +228 -0
- package/recce-source/js/src/components/ui/dataGrid/DataFrameColumnHeader.tsx +113 -0
- package/recce-source/js/src/components/ui/dataGrid/defaultRenderCell.tsx +72 -0
- package/recce-source/js/src/components/ui/dataGrid/index.ts +23 -0
- package/recce-source/js/src/components/ui/dataGrid/inlineRenderCell.test.tsx +607 -0
- package/recce-source/js/src/components/ui/dataGrid/inlineRenderCell.tsx +211 -0
- package/recce-source/js/src/components/ui/dataGrid/schemaCells.test.tsx +452 -0
- package/recce-source/js/src/components/ui/dataGrid/schemaCells.tsx +142 -0
- package/recce-source/js/src/components/ui/dataGrid/valueDiffCells.test.tsx +178 -0
- package/recce-source/js/src/components/ui/dataGrid/valueDiffCells.tsx +275 -0
- package/recce-source/js/src/components/ui/markdown/ExternalLinkConfirmDialog.tsx +134 -0
- package/recce-source/js/src/components/ui/markdown/MarkdownContent.tsx +364 -0
- package/recce-source/js/src/components/ui/mui/index.ts +13 -0
- package/recce-source/js/src/components/ui/mui-provider.tsx +67 -0
- package/recce-source/js/src/components/ui/mui-theme.ts +1039 -0
- package/recce-source/js/src/components/ui/mui-utils.ts +113 -0
- package/recce-source/js/src/components/ui/toaster.tsx +288 -0
- package/recce-source/js/src/components/valuediff/ValueDiffDetailResultView.tsx +217 -0
- package/recce-source/js/src/components/valuediff/ValueDiffForm.tsx +246 -0
- package/recce-source/js/src/components/valuediff/ValueDiffResultView.tsx +82 -0
- package/recce-source/js/src/components/valuediff/shared.ts +33 -0
- package/recce-source/js/src/constants/tooltipMessage.ts +3 -0
- package/recce-source/js/src/constants/urls.ts +1 -0
- package/recce-source/js/src/lib/UrlHash.ts +12 -0
- package/recce-source/js/src/lib/api/adhocQuery.ts +70 -0
- package/recce-source/js/src/lib/api/axiosClient.ts +9 -0
- package/recce-source/js/src/lib/api/cacheKeys.ts +13 -0
- package/recce-source/js/src/lib/api/checkEvents.ts +252 -0
- package/recce-source/js/src/lib/api/checks.ts +129 -0
- package/recce-source/js/src/lib/api/cll.ts +53 -0
- package/recce-source/js/src/lib/api/connectToCloud.ts +13 -0
- package/recce-source/js/src/lib/api/flag.ts +37 -0
- package/recce-source/js/src/lib/api/info.ts +198 -0
- package/recce-source/js/src/lib/api/instanceInfo.ts +25 -0
- package/recce-source/js/src/lib/api/keepAlive.ts +108 -0
- package/recce-source/js/src/lib/api/lineagecheck.ts +35 -0
- package/recce-source/js/src/lib/api/localStorageKeys.ts +7 -0
- package/recce-source/js/src/lib/api/models.ts +59 -0
- package/recce-source/js/src/lib/api/profile.ts +65 -0
- package/recce-source/js/src/lib/api/rowcount.ts +19 -0
- package/recce-source/js/src/lib/api/runs.ts +174 -0
- package/recce-source/js/src/lib/api/schemacheck.ts +31 -0
- package/recce-source/js/src/lib/api/select.ts +25 -0
- package/recce-source/js/src/lib/api/sessionStorageKeys.ts +8 -0
- package/recce-source/js/src/lib/api/state.ts +117 -0
- package/recce-source/js/src/lib/api/track.ts +281 -0
- package/recce-source/js/src/lib/api/types.ts +284 -0
- package/recce-source/js/src/lib/api/user.ts +42 -0
- package/recce-source/js/src/lib/api/valuediff.ts +46 -0
- package/recce-source/js/src/lib/api/version.ts +40 -0
- package/recce-source/js/src/lib/const.ts +9 -0
- package/recce-source/js/src/lib/dataGrid/crossFunctionConsistency.test.ts +626 -0
- package/recce-source/js/src/lib/dataGrid/dataGridFactory.test.ts +2140 -0
- package/recce-source/js/src/lib/dataGrid/dataGridFactory.ts +397 -0
- package/recce-source/js/src/lib/dataGrid/generators/rowCountUtils.test.ts +132 -0
- package/recce-source/js/src/lib/dataGrid/generators/rowCountUtils.ts +126 -0
- package/recce-source/js/src/lib/dataGrid/generators/toDataDiffGrid.test.ts +1627 -0
- package/recce-source/js/src/lib/dataGrid/generators/toDataDiffGrid.ts +140 -0
- package/recce-source/js/src/lib/dataGrid/generators/toDataGrid.ts +67 -0
- package/recce-source/js/src/lib/dataGrid/generators/toRowCountDataGrid.test.ts +142 -0
- package/recce-source/js/src/lib/dataGrid/generators/toRowCountDataGrid.ts +71 -0
- package/recce-source/js/src/lib/dataGrid/generators/toRowCountDiffDataGrid.test.ts +258 -0
- package/recce-source/js/src/lib/dataGrid/generators/toRowCountDiffDataGrid.ts +153 -0
- package/recce-source/js/src/lib/dataGrid/generators/toSchemaDataGrid.test.ts +951 -0
- package/recce-source/js/src/lib/dataGrid/generators/toSchemaDataGrid.ts +221 -0
- package/recce-source/js/src/lib/dataGrid/generators/toValueDataGrid.test.ts +395 -0
- package/recce-source/js/src/lib/dataGrid/generators/toValueDataGrid.ts +184 -0
- package/recce-source/js/src/lib/dataGrid/generators/toValueDiffGrid.test.ts +884 -0
- package/recce-source/js/src/lib/dataGrid/generators/toValueDiffGrid.ts +113 -0
- package/recce-source/js/src/lib/dataGrid/index.ts +51 -0
- package/recce-source/js/src/lib/dataGrid/propertyBased.test.ts +858 -0
- package/recce-source/js/src/lib/dataGrid/shared/columnBuilders.test.ts +482 -0
- package/recce-source/js/src/lib/dataGrid/shared/columnBuilders.ts +345 -0
- package/recce-source/js/src/lib/dataGrid/shared/dataTypeEdgeCases.test.ts +698 -0
- package/recce-source/js/src/lib/dataGrid/shared/diffColumnBuilder.test.tsx +820 -0
- package/recce-source/js/src/lib/dataGrid/shared/diffColumnBuilder.tsx +277 -0
- package/recce-source/js/src/lib/dataGrid/shared/gridUtils.test.ts +785 -0
- package/recce-source/js/src/lib/dataGrid/shared/gridUtils.ts +370 -0
- package/recce-source/js/src/lib/dataGrid/shared/index.ts +81 -0
- package/recce-source/js/src/lib/dataGrid/shared/rowBuilders.test.ts +909 -0
- package/recce-source/js/src/lib/dataGrid/shared/rowBuilders.ts +325 -0
- package/recce-source/js/src/lib/dataGrid/shared/simpleColumnBuilder.tsx +240 -0
- package/recce-source/js/src/lib/dataGrid/shared/toDiffColumn.test.tsx +719 -0
- package/recce-source/js/src/lib/dataGrid/shared/toDiffColumn.tsx +231 -0
- package/recce-source/js/src/lib/dataGrid/shared/validation.test.ts +559 -0
- package/recce-source/js/src/lib/dataGrid/shared/validation.ts +367 -0
- package/recce-source/js/src/lib/dataGrid/warehouseNamingConventions.test.ts +1117 -0
- package/recce-source/js/src/lib/formatSelect.ts +50 -0
- package/recce-source/js/src/lib/hooks/ApiConfigContext.tsx +181 -0
- package/recce-source/js/src/lib/hooks/IdleTimeoutContext.tsx +177 -0
- package/recce-source/js/src/lib/hooks/LineageGraphContext.tsx +512 -0
- package/recce-source/js/src/lib/hooks/RecceActionContext.tsx +269 -0
- package/recce-source/js/src/lib/hooks/RecceCheckContext.tsx +33 -0
- package/recce-source/js/src/lib/hooks/RecceContextProvider.tsx +54 -0
- package/recce-source/js/src/lib/hooks/RecceInstanceContext.tsx +129 -0
- package/recce-source/js/src/lib/hooks/RecceQueryContext.tsx +98 -0
- package/recce-source/js/src/lib/hooks/RecceShareStateContext.tsx +59 -0
- package/recce-source/js/src/lib/hooks/ScreenShot.tsx +399 -0
- package/recce-source/js/src/lib/hooks/useAppRouter.test.ts +211 -0
- package/recce-source/js/src/lib/hooks/useAppRouter.ts +200 -0
- package/recce-source/js/src/lib/hooks/useCheckEvents.ts +99 -0
- package/recce-source/js/src/lib/hooks/useCheckToast.tsx +14 -0
- package/recce-source/js/src/lib/hooks/useClipBoardToast.tsx +27 -0
- package/recce-source/js/src/lib/hooks/useCountdownToast.tsx +102 -0
- package/recce-source/js/src/lib/hooks/useFeedbackCollectionToast.tsx +130 -0
- package/recce-source/js/src/lib/hooks/useGuideToast.tsx +45 -0
- package/recce-source/js/src/lib/hooks/useIdleDetection.tsx +185 -0
- package/recce-source/js/src/lib/hooks/useModelColumns.tsx +113 -0
- package/recce-source/js/src/lib/hooks/useRecceInstanceInfo.tsx +13 -0
- package/recce-source/js/src/lib/hooks/useRecceServerFlag.tsx +13 -0
- package/recce-source/js/src/lib/hooks/useRun.tsx +89 -0
- package/recce-source/js/src/lib/hooks/useThemeColors.ts +115 -0
- package/recce-source/js/src/lib/mergeKeys.test.ts +89 -0
- package/recce-source/js/src/lib/mergeKeys.ts +86 -0
- package/recce-source/js/src/lib/result/ResultErrorFallback.tsx +9 -0
- package/recce-source/js/src/lib/utils/formatTime.ts +84 -0
- package/recce-source/js/src/lib/utils/urls.ts +16 -0
- package/recce-source/js/src/utils/DropdownValuesInput.tsx +297 -0
- package/recce-source/js/src/utils/formatters.tsx +237 -0
- package/recce-source/js/src/utils/transforms.ts +81 -0
- package/recce-source/js/tsconfig.json +47 -0
- package/recce-source/macros/README.md +8 -0
- package/recce-source/macros/recce_athena.sql +73 -0
- package/recce-source/pyproject.toml +109 -0
- package/recce-source/recce/VERSION +1 -0
- package/recce-source/recce/__init__.py +84 -0
- package/recce-source/recce/adapter/__init__.py +0 -0
- package/recce-source/recce/adapter/base.py +109 -0
- package/recce-source/recce/adapter/dbt_adapter/__init__.py +1699 -0
- package/recce-source/recce/adapter/dbt_adapter/dbt_version.py +42 -0
- package/recce-source/recce/adapter/sqlmesh_adapter.py +141 -0
- package/recce-source/recce/apis/__init__.py +0 -0
- package/recce-source/recce/apis/check_api.py +203 -0
- package/recce-source/recce/apis/check_events_api.py +353 -0
- package/recce-source/recce/apis/check_func.py +130 -0
- package/recce-source/recce/apis/run_api.py +130 -0
- package/recce-source/recce/apis/run_func.py +258 -0
- package/recce-source/recce/artifact.py +266 -0
- package/recce-source/recce/cli.py +1846 -0
- package/recce-source/recce/config.py +127 -0
- package/recce-source/recce/connect_to_cloud.py +138 -0
- package/recce-source/recce/core.py +334 -0
- package/recce-source/recce/diff.py +26 -0
- package/recce-source/recce/event/CONFIG +1 -0
- package/recce-source/recce/event/SENTRY_DNS +1 -0
- package/recce-source/recce/event/__init__.py +304 -0
- package/recce-source/recce/event/collector.py +184 -0
- package/recce-source/recce/event/track.py +158 -0
- package/recce-source/recce/exceptions.py +21 -0
- package/recce-source/recce/git.py +77 -0
- package/recce-source/recce/github.py +222 -0
- package/recce-source/recce/mcp_server.py +861 -0
- package/recce-source/recce/models/__init__.py +6 -0
- package/recce-source/recce/models/check.py +473 -0
- package/recce-source/recce/models/run.py +46 -0
- package/recce-source/recce/models/types.py +218 -0
- package/recce-source/recce/pull_request.py +124 -0
- package/recce-source/recce/run.py +390 -0
- package/recce-source/recce/server.py +877 -0
- package/recce-source/recce/state/__init__.py +31 -0
- package/recce-source/recce/state/cloud.py +644 -0
- package/recce-source/recce/state/const.py +26 -0
- package/recce-source/recce/state/local.py +56 -0
- package/recce-source/recce/state/state.py +119 -0
- package/recce-source/recce/state/state_loader.py +174 -0
- package/recce-source/recce/summary.py +575 -0
- package/recce-source/recce/tasks/__init__.py +23 -0
- package/recce-source/recce/tasks/core.py +134 -0
- package/recce-source/recce/tasks/dataframe.py +170 -0
- package/recce-source/recce/tasks/histogram.py +433 -0
- package/recce-source/recce/tasks/lineage.py +19 -0
- package/recce-source/recce/tasks/profile.py +298 -0
- package/recce-source/recce/tasks/query.py +450 -0
- package/recce-source/recce/tasks/rowcount.py +277 -0
- package/recce-source/recce/tasks/schema.py +65 -0
- package/recce-source/recce/tasks/top_k.py +172 -0
- package/recce-source/recce/tasks/utils.py +147 -0
- package/recce-source/recce/tasks/valuediff.py +497 -0
- package/recce-source/recce/util/__init__.py +4 -0
- package/recce-source/recce/util/api_token.py +80 -0
- package/recce-source/recce/util/breaking.py +330 -0
- package/recce-source/recce/util/cache.py +25 -0
- package/recce-source/recce/util/cll.py +355 -0
- package/recce-source/recce/util/cloud/__init__.py +15 -0
- package/recce-source/recce/util/cloud/base.py +115 -0
- package/recce-source/recce/util/cloud/check_events.py +190 -0
- package/recce-source/recce/util/cloud/checks.py +242 -0
- package/recce-source/recce/util/io.py +120 -0
- package/recce-source/recce/util/lineage.py +83 -0
- package/recce-source/recce/util/logger.py +25 -0
- package/recce-source/recce/util/onboarding_state.py +45 -0
- package/recce-source/recce/util/perf_tracking.py +85 -0
- package/recce-source/recce/util/pydantic_model.py +22 -0
- package/recce-source/recce/util/recce_cloud.py +454 -0
- package/recce-source/recce/util/singleton.py +18 -0
- package/recce-source/recce/util/startup_perf.py +121 -0
- package/recce-source/recce/yaml/__init__.py +58 -0
- package/recce-source/recce_cloud/README.md +780 -0
- package/recce-source/recce_cloud/VERSION +1 -0
- package/recce-source/recce_cloud/__init__.py +24 -0
- package/recce-source/recce_cloud/api/__init__.py +17 -0
- package/recce-source/recce_cloud/api/base.py +132 -0
- package/recce-source/recce_cloud/api/client.py +186 -0
- package/recce-source/recce_cloud/api/exceptions.py +26 -0
- package/recce-source/recce_cloud/api/factory.py +63 -0
- package/recce-source/recce_cloud/api/github.py +106 -0
- package/recce-source/recce_cloud/api/gitlab.py +111 -0
- package/recce-source/recce_cloud/artifact.py +57 -0
- package/recce-source/recce_cloud/ci_providers/__init__.py +9 -0
- package/recce-source/recce_cloud/ci_providers/base.py +82 -0
- package/recce-source/recce_cloud/ci_providers/detector.py +147 -0
- package/recce-source/recce_cloud/ci_providers/github_actions.py +136 -0
- package/recce-source/recce_cloud/ci_providers/gitlab_ci.py +130 -0
- package/recce-source/recce_cloud/cli.py +434 -0
- package/recce-source/recce_cloud/download.py +230 -0
- package/recce-source/recce_cloud/hatch_build.py +20 -0
- package/recce-source/recce_cloud/pyproject.toml +49 -0
- package/recce-source/recce_cloud/upload.py +214 -0
- package/recce-source/test.py +0 -0
- package/recce-source/tests/__init__.py +0 -0
- package/recce-source/tests/adapter/__init__.py +0 -0
- package/recce-source/tests/adapter/dbt_adapter/__init__.py +0 -0
- package/recce-source/tests/adapter/dbt_adapter/conftest.py +17 -0
- package/recce-source/tests/adapter/dbt_adapter/dbt_test_helper.py +298 -0
- package/recce-source/tests/adapter/dbt_adapter/test_dbt_adapter.py +25 -0
- package/recce-source/tests/adapter/dbt_adapter/test_dbt_cll.py +717 -0
- package/recce-source/tests/adapter/dbt_adapter/test_proj/dbt_project.yml +4 -0
- package/recce-source/tests/adapter/dbt_adapter/test_proj/manifest.json +1 -0
- package/recce-source/tests/adapter/dbt_adapter/test_proj/package-lock.yml +8 -0
- package/recce-source/tests/adapter/dbt_adapter/test_proj/packages.yml +7 -0
- package/recce-source/tests/adapter/dbt_adapter/test_proj/profiles.yml +6 -0
- package/recce-source/tests/adapter/dbt_adapter/test_selector.py +205 -0
- package/recce-source/tests/apis/__init__.py +0 -0
- package/recce-source/tests/apis/row_count_diff.json +59 -0
- package/recce-source/tests/apis/test_check_events_api.py +615 -0
- package/recce-source/tests/apis/test_run_func.py +433 -0
- package/recce-source/tests/catalog.json +527 -0
- package/recce-source/tests/data/manifest/base/catalog.json +1 -0
- package/recce-source/tests/data/manifest/base/manifest.json +1 -0
- package/recce-source/tests/data/manifest/pr2/catalog.json +1 -0
- package/recce-source/tests/data/manifest/pr2/manifest.json +1 -0
- package/recce-source/tests/manifest.json +10655 -0
- package/recce-source/tests/models/__init__.py +0 -0
- package/recce-source/tests/models/test_check.py +731 -0
- package/recce-source/tests/models/test_run_models.py +295 -0
- package/recce-source/tests/recce_cloud/__init__.py +0 -0
- package/recce-source/tests/recce_cloud/test_ci_providers.py +351 -0
- package/recce-source/tests/recce_cloud/test_cli.py +735 -0
- package/recce-source/tests/recce_cloud/test_client.py +379 -0
- package/recce-source/tests/recce_cloud/test_platform_clients.py +483 -0
- package/recce-source/tests/recce_state.json +1 -0
- package/recce-source/tests/state/test_cloud.py +719 -0
- package/recce-source/tests/state/test_local.py +164 -0
- package/recce-source/tests/state/test_state_loader.py +211 -0
- package/recce-source/tests/tasks/__init__.py +0 -0
- package/recce-source/tests/tasks/conftest.py +4 -0
- package/recce-source/tests/tasks/test_histogram.py +129 -0
- package/recce-source/tests/tasks/test_lineage.py +55 -0
- package/recce-source/tests/tasks/test_preset_checks.py +64 -0
- package/recce-source/tests/tasks/test_profile.py +397 -0
- package/recce-source/tests/tasks/test_query.py +528 -0
- package/recce-source/tests/tasks/test_row_count.py +133 -0
- package/recce-source/tests/tasks/test_schema.py +122 -0
- package/recce-source/tests/tasks/test_top_k.py +77 -0
- package/recce-source/tests/tasks/test_utils.py +439 -0
- package/recce-source/tests/tasks/test_valuediff.py +361 -0
- package/recce-source/tests/test_cli.py +236 -0
- package/recce-source/tests/test_cli_mcp_optional.py +45 -0
- package/recce-source/tests/test_cloud_listing_cli.py +324 -0
- package/recce-source/tests/test_config.py +43 -0
- package/recce-source/tests/test_connect_to_cloud.py +82 -0
- package/recce-source/tests/test_core.py +174 -0
- package/recce-source/tests/test_dbt.py +36 -0
- package/recce-source/tests/test_mcp_server.py +505 -0
- package/recce-source/tests/test_pull_request.py +130 -0
- package/recce-source/tests/test_server.py +202 -0
- package/recce-source/tests/test_server_lifespan.py +138 -0
- package/recce-source/tests/test_summary.py +73 -0
- package/recce-source/tests/util/__init__.py +0 -0
- package/recce-source/tests/util/cloud/__init__.py +0 -0
- package/recce-source/tests/util/cloud/test_check_events.py +255 -0
- package/recce-source/tests/util/cloud/test_checks.py +204 -0
- package/recce-source/tests/util/test_api_token.py +119 -0
- package/recce-source/tests/util/test_breaking.py +1427 -0
- package/recce-source/tests/util/test_cll.py +706 -0
- package/recce-source/tests/util/test_lineage.py +122 -0
- package/recce-source/tests/util/test_onboarding_state.py +84 -0
- package/recce-source/tests/util/test_recce_cloud.py +231 -0
- package/recce-source/tox.ini +40 -0
- package/recce-source/uv.lock +3928 -0
- package/src/api/index.ts +32 -0
- package/src/components/index.ts +154 -0
- package/src/global.d.ts +14 -0
- package/src/hooks/index.ts +56 -0
- package/src/index.ts +17 -0
- package/src/lib/hooks/RouteConfigContext.ts +139 -0
- package/src/lib/hooks/useAppRouter.ts +240 -0
- package/src/mui-augmentation.d.ts +139 -0
- package/src/theme/index.ts +13 -0
- package/src/theme.ts +23 -0
- package/src/types/index.ts +23 -0
- package/dist/index-BNUP2V_N.d.ts.map +0 -1
- package/dist/index-DOPZuhD8.d.mts.map +0 -1
- package/dist/theme.d.mts.map +0 -1
- package/dist/theme.d.ts.map +0 -1
|
@@ -0,0 +1,884 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file toValueDiffGrid.test.ts
|
|
3
|
+
* @description Comprehensive tests for value diff grid generation
|
|
4
|
+
*
|
|
5
|
+
* Tests cover:
|
|
6
|
+
* - Row transformation and status detection (added/removed/modified)
|
|
7
|
+
* - Primary key handling (required, single, multiple, case-insensitive)
|
|
8
|
+
* - in_a/in_b column handling for base/current row identification
|
|
9
|
+
* - Column filtering (changedOnly, pinned columns)
|
|
10
|
+
* - Display modes (inline, side_by_side)
|
|
11
|
+
* - Edge cases (null values, case sensitivity)
|
|
12
|
+
*
|
|
13
|
+
* Type Reference (from @/lib/api/types.ts):
|
|
14
|
+
* - ColumnType: "number" | "integer" | "text" | "boolean" | "date" | "datetime" | "timedelta" | "unknown"
|
|
15
|
+
* - ColumnRenderMode: "raw" | "percent" | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9
|
|
16
|
+
* - RowObjectType.__status: "added" | "removed" | "modified" | undefined
|
|
17
|
+
* - displayMode: "side_by_side" | "inline" (default is "inline" for valuediff)
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
// Mock ag-grid-community since tests don't need actual rendering
|
|
21
|
+
jest.mock("ag-grid-community", () => ({
|
|
22
|
+
ModuleRegistry: {
|
|
23
|
+
registerModules: jest.fn(),
|
|
24
|
+
},
|
|
25
|
+
}));
|
|
26
|
+
|
|
27
|
+
// Mock MUI wrapper components
|
|
28
|
+
jest.mock("@/components/ui/mui", () => ({
|
|
29
|
+
Box: ({ children }: { children: React.ReactNode }) => children,
|
|
30
|
+
Flex: ({ children }: { children: React.ReactNode }) => children,
|
|
31
|
+
Icon: () => null,
|
|
32
|
+
IconButton: () => null,
|
|
33
|
+
Menu: {
|
|
34
|
+
Root: ({ children }: { children: React.ReactNode }) => children,
|
|
35
|
+
Trigger: ({ children }: { children: React.ReactNode }) => children,
|
|
36
|
+
Content: ({ children }: { children: React.ReactNode }) => children,
|
|
37
|
+
Item: ({ children }: { children: React.ReactNode }) => children,
|
|
38
|
+
ItemGroup: ({ children }: { children: React.ReactNode }) => children,
|
|
39
|
+
Positioner: ({ children }: { children: React.ReactNode }) => children,
|
|
40
|
+
},
|
|
41
|
+
Portal: ({ children }: { children: React.ReactNode }) => children,
|
|
42
|
+
Text: ({ children }: { children: React.ReactNode }) => children,
|
|
43
|
+
}));
|
|
44
|
+
|
|
45
|
+
import { ColumnType, DataFrame, RowData } from "@/lib/api/types";
|
|
46
|
+
import { toValueDiffGrid } from "@/lib/dataGrid/generators/toValueDiffGrid";
|
|
47
|
+
|
|
48
|
+
// ============================================================================
|
|
49
|
+
// Test Fixtures
|
|
50
|
+
// ============================================================================
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Creates a DataFrame with in_a/in_b columns for value diff testing.
|
|
54
|
+
* in_a indicates the row exists in base, in_b indicates it exists in current.
|
|
55
|
+
*/
|
|
56
|
+
const createJoinedDataFrame = (
|
|
57
|
+
columns: Array<{ name: string; key: string; type: ColumnType }>,
|
|
58
|
+
data: RowData[],
|
|
59
|
+
): DataFrame => ({
|
|
60
|
+
columns: [
|
|
61
|
+
...columns,
|
|
62
|
+
{ name: "in_a", key: "in_a", type: "boolean" },
|
|
63
|
+
{ name: "in_b", key: "in_b", type: "boolean" },
|
|
64
|
+
],
|
|
65
|
+
data,
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
// Standard fixture: 3 rows with different statuses
|
|
69
|
+
const standardFixture: DataFrame = createJoinedDataFrame(
|
|
70
|
+
[
|
|
71
|
+
{ name: "id", key: "id", type: "integer" },
|
|
72
|
+
{ name: "name", key: "name", type: "text" },
|
|
73
|
+
{ name: "value", key: "value", type: "integer" },
|
|
74
|
+
],
|
|
75
|
+
[
|
|
76
|
+
// Row in both base and current (unchanged)
|
|
77
|
+
[1, "Alice", 100, true, true],
|
|
78
|
+
// Row in both but with different values (will show as same row, modified detection happens elsewhere)
|
|
79
|
+
[2, "Bob", 200, true, true],
|
|
80
|
+
// Row only in base (removed)
|
|
81
|
+
[3, "Charlie", 300, true, false],
|
|
82
|
+
// Row only in current (added)
|
|
83
|
+
[4, "Diana", 400, false, true],
|
|
84
|
+
],
|
|
85
|
+
);
|
|
86
|
+
|
|
87
|
+
// ============================================================================
|
|
88
|
+
// Basic Functionality Tests
|
|
89
|
+
// ============================================================================
|
|
90
|
+
|
|
91
|
+
describe("toValueDiffGrid - Basic Functionality", () => {
|
|
92
|
+
test("generates grid with single primary key", () => {
|
|
93
|
+
const result = toValueDiffGrid(standardFixture, ["id"]);
|
|
94
|
+
|
|
95
|
+
expect(result.rows).toHaveLength(4);
|
|
96
|
+
expect(result.columns.length).toBeGreaterThan(0);
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
test("generates grid with multiple primary keys", () => {
|
|
100
|
+
const df = createJoinedDataFrame(
|
|
101
|
+
[
|
|
102
|
+
{ name: "region", key: "region", type: "text" },
|
|
103
|
+
{ name: "product", key: "product", type: "text" },
|
|
104
|
+
{ name: "sales", key: "sales", type: "integer" },
|
|
105
|
+
],
|
|
106
|
+
[
|
|
107
|
+
["US", "Widget", 100, true, true],
|
|
108
|
+
["US", "Gadget", 200, true, true],
|
|
109
|
+
["EU", "Widget", 150, true, false],
|
|
110
|
+
],
|
|
111
|
+
);
|
|
112
|
+
|
|
113
|
+
const result = toValueDiffGrid(df, ["region", "product"]);
|
|
114
|
+
|
|
115
|
+
expect(result.rows).toHaveLength(3);
|
|
116
|
+
// Primary keys should be columns
|
|
117
|
+
expect(result.columns.length).toBeGreaterThanOrEqual(2);
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
test("throws error when primary keys are empty", () => {
|
|
121
|
+
expect(() => toValueDiffGrid(standardFixture, [])).toThrow(
|
|
122
|
+
"Primary keys are required",
|
|
123
|
+
);
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
test("throws error when primary key column not found", () => {
|
|
127
|
+
expect(() => toValueDiffGrid(standardFixture, ["nonexistent"])).toThrow(
|
|
128
|
+
"Primary key column 'nonexistent' not found",
|
|
129
|
+
);
|
|
130
|
+
});
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
// ============================================================================
|
|
134
|
+
// Row Status Detection Tests
|
|
135
|
+
// ============================================================================
|
|
136
|
+
|
|
137
|
+
describe("toValueDiffGrid - Row Status Detection", () => {
|
|
138
|
+
test("detects added rows (in_a=false, in_b=true)", () => {
|
|
139
|
+
const df = createJoinedDataFrame(
|
|
140
|
+
[
|
|
141
|
+
{ name: "id", key: "id", type: "integer" },
|
|
142
|
+
{ name: "value", key: "value", type: "integer" },
|
|
143
|
+
],
|
|
144
|
+
[
|
|
145
|
+
[1, 100, false, true], // added
|
|
146
|
+
],
|
|
147
|
+
);
|
|
148
|
+
|
|
149
|
+
const result = toValueDiffGrid(df, ["id"]);
|
|
150
|
+
|
|
151
|
+
expect(result.rows).toHaveLength(1);
|
|
152
|
+
expect(result.rows[0].__status).toBe("added");
|
|
153
|
+
});
|
|
154
|
+
|
|
155
|
+
test("detects removed rows (in_a=true, in_b=false)", () => {
|
|
156
|
+
const df = createJoinedDataFrame(
|
|
157
|
+
[
|
|
158
|
+
{ name: "id", key: "id", type: "integer" },
|
|
159
|
+
{ name: "value", key: "value", type: "integer" },
|
|
160
|
+
],
|
|
161
|
+
[
|
|
162
|
+
[1, 100, true, false], // removed
|
|
163
|
+
],
|
|
164
|
+
);
|
|
165
|
+
|
|
166
|
+
const result = toValueDiffGrid(df, ["id"]);
|
|
167
|
+
|
|
168
|
+
expect(result.rows).toHaveLength(1);
|
|
169
|
+
expect(result.rows[0].__status).toBe("removed");
|
|
170
|
+
});
|
|
171
|
+
|
|
172
|
+
test("detects unchanged rows (in_a=true, in_b=true, same values)", () => {
|
|
173
|
+
const df = createJoinedDataFrame(
|
|
174
|
+
[
|
|
175
|
+
{ name: "id", key: "id", type: "integer" },
|
|
176
|
+
{ name: "value", key: "value", type: "integer" },
|
|
177
|
+
],
|
|
178
|
+
[
|
|
179
|
+
[1, 100, true, true], // same row appears twice with same values
|
|
180
|
+
[1, 100, true, true],
|
|
181
|
+
],
|
|
182
|
+
);
|
|
183
|
+
|
|
184
|
+
const result = toValueDiffGrid(df, ["id"]);
|
|
185
|
+
|
|
186
|
+
// Both rows have same PK, so they merge to one
|
|
187
|
+
expect(result.rows.length).toBeGreaterThanOrEqual(1);
|
|
188
|
+
// When values match, status is undefined (unchanged)
|
|
189
|
+
const row = result.rows.find((r) => r.id === 1);
|
|
190
|
+
expect(row?.__status).toBeUndefined();
|
|
191
|
+
});
|
|
192
|
+
|
|
193
|
+
test("detects modified rows when values differ", () => {
|
|
194
|
+
const df = createJoinedDataFrame(
|
|
195
|
+
[
|
|
196
|
+
{ name: "id", key: "id", type: "integer" },
|
|
197
|
+
{ name: "value", key: "value", type: "integer" },
|
|
198
|
+
],
|
|
199
|
+
[
|
|
200
|
+
[1, 100, true, false], // base version
|
|
201
|
+
[1, 150, false, true], // current version (different value)
|
|
202
|
+
],
|
|
203
|
+
);
|
|
204
|
+
|
|
205
|
+
const result = toValueDiffGrid(df, ["id"]);
|
|
206
|
+
|
|
207
|
+
const row = result.rows.find((r) => r.id === 1);
|
|
208
|
+
expect(row?.__status).toBe("modified");
|
|
209
|
+
expect(row?.base__value).toBe(100);
|
|
210
|
+
expect(row?.current__value).toBe(150);
|
|
211
|
+
});
|
|
212
|
+
|
|
213
|
+
test("handles mixed status rows correctly", () => {
|
|
214
|
+
const df = createJoinedDataFrame(
|
|
215
|
+
[
|
|
216
|
+
{ name: "id", key: "id", type: "integer" },
|
|
217
|
+
{ name: "val", key: "val", type: "integer" },
|
|
218
|
+
],
|
|
219
|
+
[
|
|
220
|
+
[1, 100, true, true], // unchanged (same key, both present)
|
|
221
|
+
[2, 200, true, false], // removed
|
|
222
|
+
[3, 300, false, true], // added
|
|
223
|
+
[4, 400, true, false], // modified (base)
|
|
224
|
+
[4, 450, false, true], // modified (current)
|
|
225
|
+
],
|
|
226
|
+
);
|
|
227
|
+
|
|
228
|
+
const result = toValueDiffGrid(df, ["id"]);
|
|
229
|
+
|
|
230
|
+
const statusMap = new Map(result.rows.map((r) => [r.id, r.__status]));
|
|
231
|
+
|
|
232
|
+
expect(statusMap.get(1)).toBeUndefined(); // unchanged
|
|
233
|
+
expect(statusMap.get(2)).toBe("removed");
|
|
234
|
+
expect(statusMap.get(3)).toBe("added");
|
|
235
|
+
expect(statusMap.get(4)).toBe("modified");
|
|
236
|
+
});
|
|
237
|
+
});
|
|
238
|
+
|
|
239
|
+
// ============================================================================
|
|
240
|
+
// in_a/in_b Column Handling Tests
|
|
241
|
+
// ============================================================================
|
|
242
|
+
|
|
243
|
+
describe("toValueDiffGrid - in_a/in_b Column Handling", () => {
|
|
244
|
+
test("handles lowercase in_a/in_b columns", () => {
|
|
245
|
+
const df: DataFrame = {
|
|
246
|
+
columns: [
|
|
247
|
+
{ name: "id", key: "id", type: "integer" },
|
|
248
|
+
{ name: "value", key: "value", type: "integer" },
|
|
249
|
+
{ name: "in_a", key: "in_a", type: "boolean" },
|
|
250
|
+
{ name: "in_b", key: "in_b", type: "boolean" },
|
|
251
|
+
],
|
|
252
|
+
data: [
|
|
253
|
+
[1, 100, true, true],
|
|
254
|
+
[2, 200, true, false],
|
|
255
|
+
],
|
|
256
|
+
};
|
|
257
|
+
|
|
258
|
+
const result = toValueDiffGrid(df, ["id"]);
|
|
259
|
+
|
|
260
|
+
expect(result.rows).toHaveLength(2);
|
|
261
|
+
// in_a/in_b columns should be excluded from output columns
|
|
262
|
+
const columnKeys = result.columns
|
|
263
|
+
.map((c) => ("field" in c ? c.field : undefined))
|
|
264
|
+
.filter(Boolean);
|
|
265
|
+
expect(columnKeys).not.toContain("in_a");
|
|
266
|
+
expect(columnKeys).not.toContain("in_b");
|
|
267
|
+
});
|
|
268
|
+
|
|
269
|
+
test("excludes in_a/in_b from output columns", () => {
|
|
270
|
+
const result = toValueDiffGrid(standardFixture, ["id"]);
|
|
271
|
+
|
|
272
|
+
// Check that neither in_a nor in_b appear in any column configuration
|
|
273
|
+
const allColumnKeys: string[] = [];
|
|
274
|
+
result.columns.forEach((col) => {
|
|
275
|
+
if ("field" in col && typeof col.field === "string") {
|
|
276
|
+
allColumnKeys.push(col.field);
|
|
277
|
+
}
|
|
278
|
+
if ("children" in col && Array.isArray(col.children)) {
|
|
279
|
+
col.children.forEach((child) => {
|
|
280
|
+
if ("field" in child && typeof child.field === "string") {
|
|
281
|
+
allColumnKeys.push(child.field);
|
|
282
|
+
}
|
|
283
|
+
});
|
|
284
|
+
}
|
|
285
|
+
});
|
|
286
|
+
|
|
287
|
+
expect(allColumnKeys).not.toContain("in_a");
|
|
288
|
+
expect(allColumnKeys).not.toContain("in_b");
|
|
289
|
+
});
|
|
290
|
+
});
|
|
291
|
+
|
|
292
|
+
// ============================================================================
|
|
293
|
+
// Changed Only Filter Tests
|
|
294
|
+
// ============================================================================
|
|
295
|
+
|
|
296
|
+
describe("toValueDiffGrid - Changed Only Filter", () => {
|
|
297
|
+
test("filters to show only changed rows when changedOnly is true", () => {
|
|
298
|
+
const df = createJoinedDataFrame(
|
|
299
|
+
[
|
|
300
|
+
{ name: "id", key: "id", type: "integer" },
|
|
301
|
+
{ name: "value", key: "value", type: "integer" },
|
|
302
|
+
],
|
|
303
|
+
[
|
|
304
|
+
[1, 100, true, true], // unchanged
|
|
305
|
+
[2, 200, true, false], // removed
|
|
306
|
+
[3, 300, false, true], // added
|
|
307
|
+
],
|
|
308
|
+
);
|
|
309
|
+
|
|
310
|
+
const result = toValueDiffGrid(df, ["id"], { changedOnly: true });
|
|
311
|
+
|
|
312
|
+
// Should only include removed and added rows
|
|
313
|
+
expect(result.rows).toHaveLength(2);
|
|
314
|
+
expect(result.rows.every((r) => r.__status !== undefined)).toBe(true);
|
|
315
|
+
});
|
|
316
|
+
|
|
317
|
+
test("includes all rows when changedOnly is false", () => {
|
|
318
|
+
const df = createJoinedDataFrame(
|
|
319
|
+
[
|
|
320
|
+
{ name: "id", key: "id", type: "integer" },
|
|
321
|
+
{ name: "value", key: "value", type: "integer" },
|
|
322
|
+
],
|
|
323
|
+
[
|
|
324
|
+
[1, 100, true, true], // unchanged
|
|
325
|
+
[2, 200, true, false], // removed
|
|
326
|
+
[3, 300, false, true], // added
|
|
327
|
+
],
|
|
328
|
+
);
|
|
329
|
+
|
|
330
|
+
const result = toValueDiffGrid(df, ["id"], { changedOnly: false });
|
|
331
|
+
|
|
332
|
+
expect(result.rows).toHaveLength(3);
|
|
333
|
+
});
|
|
334
|
+
|
|
335
|
+
test("shows modified rows when changedOnly is true", () => {
|
|
336
|
+
const df = createJoinedDataFrame(
|
|
337
|
+
[
|
|
338
|
+
{ name: "id", key: "id", type: "integer" },
|
|
339
|
+
{ name: "value", key: "value", type: "integer" },
|
|
340
|
+
],
|
|
341
|
+
[
|
|
342
|
+
[1, 100, true, false], // base version
|
|
343
|
+
[1, 150, false, true], // current version (modified)
|
|
344
|
+
[2, 200, true, true], // unchanged
|
|
345
|
+
],
|
|
346
|
+
);
|
|
347
|
+
|
|
348
|
+
const result = toValueDiffGrid(df, ["id"], { changedOnly: true });
|
|
349
|
+
|
|
350
|
+
expect(result.rows).toHaveLength(1);
|
|
351
|
+
expect(result.rows[0].__status).toBe("modified");
|
|
352
|
+
expect(result.rows[0].id).toBe(1);
|
|
353
|
+
});
|
|
354
|
+
});
|
|
355
|
+
|
|
356
|
+
// ============================================================================
|
|
357
|
+
// Display Mode Tests
|
|
358
|
+
// ============================================================================
|
|
359
|
+
|
|
360
|
+
describe("toValueDiffGrid - Display Modes", () => {
|
|
361
|
+
test("defaults to inline display mode", () => {
|
|
362
|
+
const df = createJoinedDataFrame(
|
|
363
|
+
[
|
|
364
|
+
{ name: "id", key: "id", type: "integer" },
|
|
365
|
+
{ name: "value", key: "value", type: "integer" },
|
|
366
|
+
],
|
|
367
|
+
[[1, 100, true, true]],
|
|
368
|
+
);
|
|
369
|
+
|
|
370
|
+
const result = toValueDiffGrid(df, ["id"]);
|
|
371
|
+
|
|
372
|
+
// In inline mode, non-PK columns have key directly (no children)
|
|
373
|
+
const valueColumn = result.columns.find((col) => {
|
|
374
|
+
if ("field" in col && col.field === "value") return true;
|
|
375
|
+
return false;
|
|
376
|
+
});
|
|
377
|
+
|
|
378
|
+
// Should be a direct column, not a group with children
|
|
379
|
+
if (valueColumn) {
|
|
380
|
+
expect("children" in valueColumn).toBe(false);
|
|
381
|
+
}
|
|
382
|
+
});
|
|
383
|
+
|
|
384
|
+
test("side_by_side mode creates column groups with children", () => {
|
|
385
|
+
const df = createJoinedDataFrame(
|
|
386
|
+
[
|
|
387
|
+
{ name: "id", key: "id", type: "integer" },
|
|
388
|
+
{ name: "value", key: "value", type: "integer" },
|
|
389
|
+
],
|
|
390
|
+
[[1, 100, true, true]],
|
|
391
|
+
);
|
|
392
|
+
|
|
393
|
+
const result = toValueDiffGrid(df, ["id"], {
|
|
394
|
+
displayMode: "side_by_side",
|
|
395
|
+
});
|
|
396
|
+
|
|
397
|
+
// In side_by_side mode, non-PK columns should have children
|
|
398
|
+
const columnWithChildren = result.columns.find(
|
|
399
|
+
(col) => "children" in col && Array.isArray(col.children),
|
|
400
|
+
);
|
|
401
|
+
|
|
402
|
+
expect(columnWithChildren).toBeDefined();
|
|
403
|
+
if (columnWithChildren && "children" in columnWithChildren) {
|
|
404
|
+
expect(columnWithChildren.children).toHaveLength(2);
|
|
405
|
+
const baseChild = columnWithChildren.children?.[0];
|
|
406
|
+
const currentChild = columnWithChildren.children?.[1];
|
|
407
|
+
// Children of a column group are Column types which have 'field'
|
|
408
|
+
if (baseChild && "field" in baseChild) {
|
|
409
|
+
expect(baseChild.field).toContain("base__");
|
|
410
|
+
}
|
|
411
|
+
if (currentChild && "field" in currentChild) {
|
|
412
|
+
expect(currentChild.field).toContain("current__");
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
});
|
|
416
|
+
|
|
417
|
+
test("inline mode creates flat columns", () => {
|
|
418
|
+
const df = createJoinedDataFrame(
|
|
419
|
+
[
|
|
420
|
+
{ name: "id", key: "id", type: "integer" },
|
|
421
|
+
{ name: "value", key: "value", type: "integer" },
|
|
422
|
+
],
|
|
423
|
+
[[1, 100, true, true]],
|
|
424
|
+
);
|
|
425
|
+
|
|
426
|
+
const result = toValueDiffGrid(df, ["id"], {
|
|
427
|
+
displayMode: "inline",
|
|
428
|
+
});
|
|
429
|
+
|
|
430
|
+
// Non-PK columns should be flat (no children) in inline mode
|
|
431
|
+
const nonPKColumns = result.columns.filter((col) => {
|
|
432
|
+
if ("field" in col && col.field === "id") return false;
|
|
433
|
+
return true;
|
|
434
|
+
});
|
|
435
|
+
|
|
436
|
+
nonPKColumns.forEach((col) => {
|
|
437
|
+
const hasChildren = "children" in col && Array.isArray(col.children);
|
|
438
|
+
expect(hasChildren).toBe(false);
|
|
439
|
+
});
|
|
440
|
+
});
|
|
441
|
+
});
|
|
442
|
+
|
|
443
|
+
// ============================================================================
|
|
444
|
+
// Pinned Columns Tests
|
|
445
|
+
// ============================================================================
|
|
446
|
+
|
|
447
|
+
describe("toValueDiffGrid - Pinned Columns", () => {
|
|
448
|
+
/**
|
|
449
|
+
* Helper to extract column key from a column or column group
|
|
450
|
+
*/
|
|
451
|
+
const extractColumnKey = (
|
|
452
|
+
col: ReturnType<typeof toValueDiffGrid>["columns"][number],
|
|
453
|
+
): string | undefined => {
|
|
454
|
+
if ("field" in col && typeof col.field === "string") {
|
|
455
|
+
return col.field;
|
|
456
|
+
}
|
|
457
|
+
if (
|
|
458
|
+
"children" in col &&
|
|
459
|
+
Array.isArray(col.children) &&
|
|
460
|
+
col.children.length > 0
|
|
461
|
+
) {
|
|
462
|
+
const firstChild = col.children[0];
|
|
463
|
+
// Type guard: children of ColumnGroup are Column types which have 'field'
|
|
464
|
+
if (
|
|
465
|
+
firstChild &&
|
|
466
|
+
"field" in firstChild &&
|
|
467
|
+
typeof firstChild.field === "string"
|
|
468
|
+
) {
|
|
469
|
+
const childKey = firstChild.field;
|
|
470
|
+
if (childKey.startsWith("base__")) {
|
|
471
|
+
return childKey.slice(6);
|
|
472
|
+
}
|
|
473
|
+
return childKey;
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
return undefined;
|
|
477
|
+
};
|
|
478
|
+
|
|
479
|
+
test("pinned columns appear after primary keys", () => {
|
|
480
|
+
const df = createJoinedDataFrame(
|
|
481
|
+
[
|
|
482
|
+
{ name: "id", key: "id", type: "integer" },
|
|
483
|
+
{ name: "name", key: "name", type: "text" },
|
|
484
|
+
{ name: "value", key: "value", type: "integer" },
|
|
485
|
+
],
|
|
486
|
+
[[1, "Alice", 100, true, true]],
|
|
487
|
+
);
|
|
488
|
+
|
|
489
|
+
const result = toValueDiffGrid(df, ["id"], {
|
|
490
|
+
pinnedColumns: ["value"],
|
|
491
|
+
});
|
|
492
|
+
|
|
493
|
+
const columnKeys = result.columns
|
|
494
|
+
.map(extractColumnKey)
|
|
495
|
+
.filter((k): k is string => k !== undefined);
|
|
496
|
+
|
|
497
|
+
const idIndex = columnKeys.indexOf("id");
|
|
498
|
+
const valueIndex = columnKeys.indexOf("value");
|
|
499
|
+
const nameIndex = columnKeys.indexOf("name");
|
|
500
|
+
|
|
501
|
+
expect(idIndex).toBe(0); // PK first
|
|
502
|
+
expect(valueIndex).toBeGreaterThan(idIndex); // Pinned after PK
|
|
503
|
+
expect(nameIndex).toBeGreaterThan(valueIndex); // Regular after pinned
|
|
504
|
+
});
|
|
505
|
+
|
|
506
|
+
test("pinned columns that are also PKs are not duplicated", () => {
|
|
507
|
+
const df = createJoinedDataFrame(
|
|
508
|
+
[
|
|
509
|
+
{ name: "id", key: "id", type: "integer" },
|
|
510
|
+
{ name: "value", key: "value", type: "integer" },
|
|
511
|
+
],
|
|
512
|
+
[[1, 100, true, true]],
|
|
513
|
+
);
|
|
514
|
+
|
|
515
|
+
const result = toValueDiffGrid(df, ["id"], {
|
|
516
|
+
pinnedColumns: ["id"], // id is both PK and pinned
|
|
517
|
+
});
|
|
518
|
+
|
|
519
|
+
const idColumns = result.columns.filter((col) => {
|
|
520
|
+
const key = extractColumnKey(col);
|
|
521
|
+
return key === "id";
|
|
522
|
+
});
|
|
523
|
+
|
|
524
|
+
expect(idColumns).toHaveLength(1);
|
|
525
|
+
});
|
|
526
|
+
});
|
|
527
|
+
|
|
528
|
+
// ============================================================================
|
|
529
|
+
// Column Render Mode Tests
|
|
530
|
+
// ============================================================================
|
|
531
|
+
|
|
532
|
+
describe("toValueDiffGrid - Column Render Modes", () => {
|
|
533
|
+
test("passes columnsRenderMode to column configuration", () => {
|
|
534
|
+
const df = createJoinedDataFrame(
|
|
535
|
+
[
|
|
536
|
+
{ name: "id", key: "id", type: "integer" },
|
|
537
|
+
{ name: "percentage", key: "percentage", type: "number" },
|
|
538
|
+
],
|
|
539
|
+
[[1, 0.75, true, true]],
|
|
540
|
+
);
|
|
541
|
+
|
|
542
|
+
const result = toValueDiffGrid(df, ["id"], {
|
|
543
|
+
columnsRenderMode: {
|
|
544
|
+
percentage: "percent", // Valid ColumnRenderMode
|
|
545
|
+
},
|
|
546
|
+
});
|
|
547
|
+
|
|
548
|
+
// Find the percentage column
|
|
549
|
+
const percentageColumn = result.columns.find((col) => {
|
|
550
|
+
if ("field" in col && col.field === "percentage") return true;
|
|
551
|
+
if ("children" in col && Array.isArray(col.children)) {
|
|
552
|
+
return col.children.some(
|
|
553
|
+
(child) => "field" in child && child.field === "base__percentage",
|
|
554
|
+
);
|
|
555
|
+
}
|
|
556
|
+
return false;
|
|
557
|
+
});
|
|
558
|
+
|
|
559
|
+
expect(percentageColumn).toBeDefined();
|
|
560
|
+
if (percentageColumn && "columnRenderMode" in percentageColumn) {
|
|
561
|
+
expect(percentageColumn.columnRenderMode).toBe("percent");
|
|
562
|
+
}
|
|
563
|
+
});
|
|
564
|
+
|
|
565
|
+
test("supports numeric render modes for decimal precision", () => {
|
|
566
|
+
const df = createJoinedDataFrame(
|
|
567
|
+
[
|
|
568
|
+
{ name: "id", key: "id", type: "integer" },
|
|
569
|
+
{ name: "price", key: "price", type: "number" },
|
|
570
|
+
],
|
|
571
|
+
[[1, 19.99, true, true]],
|
|
572
|
+
);
|
|
573
|
+
|
|
574
|
+
const result = toValueDiffGrid(df, ["id"], {
|
|
575
|
+
columnsRenderMode: {
|
|
576
|
+
price: 2, // 2 decimal places - valid ColumnRenderMode
|
|
577
|
+
},
|
|
578
|
+
});
|
|
579
|
+
|
|
580
|
+
const priceColumn = result.columns.find((col) => {
|
|
581
|
+
if ("field" in col && col.field === "price") return true;
|
|
582
|
+
if ("children" in col && Array.isArray(col.children)) {
|
|
583
|
+
return col.children.some(
|
|
584
|
+
(child) => "field" in child && child.field === "base__price",
|
|
585
|
+
);
|
|
586
|
+
}
|
|
587
|
+
return false;
|
|
588
|
+
});
|
|
589
|
+
|
|
590
|
+
expect(priceColumn).toBeDefined();
|
|
591
|
+
if (priceColumn && "columnRenderMode" in priceColumn) {
|
|
592
|
+
expect(priceColumn.columnRenderMode).toBe(2);
|
|
593
|
+
}
|
|
594
|
+
});
|
|
595
|
+
});
|
|
596
|
+
|
|
597
|
+
// ============================================================================
|
|
598
|
+
// Custom Titles Tests
|
|
599
|
+
// ============================================================================
|
|
600
|
+
|
|
601
|
+
describe("toValueDiffGrid - Custom Titles", () => {
|
|
602
|
+
test("uses custom baseTitle and currentTitle in side_by_side mode", () => {
|
|
603
|
+
const df = createJoinedDataFrame(
|
|
604
|
+
[
|
|
605
|
+
{ name: "id", key: "id", type: "integer" },
|
|
606
|
+
{ name: "value", key: "value", type: "integer" },
|
|
607
|
+
],
|
|
608
|
+
[[1, 100, true, true]],
|
|
609
|
+
);
|
|
610
|
+
|
|
611
|
+
const result = toValueDiffGrid(df, ["id"], {
|
|
612
|
+
displayMode: "side_by_side",
|
|
613
|
+
baseTitle: "Production",
|
|
614
|
+
currentTitle: "Staging",
|
|
615
|
+
});
|
|
616
|
+
|
|
617
|
+
const columnWithChildren = result.columns.find(
|
|
618
|
+
(col) =>
|
|
619
|
+
"children" in col &&
|
|
620
|
+
Array.isArray(col.children) &&
|
|
621
|
+
col.children.length === 2,
|
|
622
|
+
);
|
|
623
|
+
|
|
624
|
+
expect(columnWithChildren).toBeDefined();
|
|
625
|
+
if (
|
|
626
|
+
columnWithChildren &&
|
|
627
|
+
"children" in columnWithChildren &&
|
|
628
|
+
columnWithChildren.children
|
|
629
|
+
) {
|
|
630
|
+
const baseChild = columnWithChildren.children[0];
|
|
631
|
+
const currentChild = columnWithChildren.children[1];
|
|
632
|
+
// Children of a column group are Column types which have 'name'
|
|
633
|
+
if (baseChild && "name" in baseChild) {
|
|
634
|
+
expect(baseChild.name).toBe("Production");
|
|
635
|
+
}
|
|
636
|
+
if (currentChild && "name" in currentChild) {
|
|
637
|
+
expect(currentChild.name).toBe("Staging");
|
|
638
|
+
}
|
|
639
|
+
}
|
|
640
|
+
});
|
|
641
|
+
|
|
642
|
+
test("defaults to Base and Current when no custom titles provided", () => {
|
|
643
|
+
const df = createJoinedDataFrame(
|
|
644
|
+
[
|
|
645
|
+
{ name: "id", key: "id", type: "integer" },
|
|
646
|
+
{ name: "value", key: "value", type: "integer" },
|
|
647
|
+
],
|
|
648
|
+
[[1, 100, true, true]],
|
|
649
|
+
);
|
|
650
|
+
|
|
651
|
+
const result = toValueDiffGrid(df, ["id"], {
|
|
652
|
+
displayMode: "side_by_side",
|
|
653
|
+
});
|
|
654
|
+
|
|
655
|
+
const columnWithChildren = result.columns.find(
|
|
656
|
+
(col) =>
|
|
657
|
+
"children" in col &&
|
|
658
|
+
Array.isArray(col.children) &&
|
|
659
|
+
col.children.length === 2,
|
|
660
|
+
);
|
|
661
|
+
|
|
662
|
+
expect(columnWithChildren).toBeDefined();
|
|
663
|
+
if (
|
|
664
|
+
columnWithChildren &&
|
|
665
|
+
"children" in columnWithChildren &&
|
|
666
|
+
columnWithChildren.children
|
|
667
|
+
) {
|
|
668
|
+
const baseChild = columnWithChildren.children[0];
|
|
669
|
+
const currentChild = columnWithChildren.children[1];
|
|
670
|
+
// Children of a column group are Column types which have 'name'
|
|
671
|
+
if (baseChild && "name" in baseChild) {
|
|
672
|
+
expect(baseChild.name).toBe("Base");
|
|
673
|
+
}
|
|
674
|
+
if (currentChild && "name" in currentChild) {
|
|
675
|
+
expect(currentChild.name).toBe("Current");
|
|
676
|
+
}
|
|
677
|
+
}
|
|
678
|
+
});
|
|
679
|
+
});
|
|
680
|
+
|
|
681
|
+
// ============================================================================
|
|
682
|
+
// Null and Edge Case Tests
|
|
683
|
+
// ============================================================================
|
|
684
|
+
|
|
685
|
+
describe("toValueDiffGrid - Null and Edge Cases", () => {
|
|
686
|
+
test("handles null values in data columns", () => {
|
|
687
|
+
const df = createJoinedDataFrame(
|
|
688
|
+
[
|
|
689
|
+
{ name: "id", key: "id", type: "integer" },
|
|
690
|
+
{ name: "name", key: "name", type: "text" },
|
|
691
|
+
],
|
|
692
|
+
[[1, null, true, true]],
|
|
693
|
+
);
|
|
694
|
+
|
|
695
|
+
const result = toValueDiffGrid(df, ["id"]);
|
|
696
|
+
|
|
697
|
+
expect(result.rows).toHaveLength(1);
|
|
698
|
+
expect(result.rows[0].base__name).toBeNull();
|
|
699
|
+
expect(result.rows[0].current__name).toBeNull();
|
|
700
|
+
});
|
|
701
|
+
|
|
702
|
+
test("handles null primary key values", () => {
|
|
703
|
+
const df = createJoinedDataFrame(
|
|
704
|
+
[
|
|
705
|
+
{ name: "id", key: "id", type: "integer" },
|
|
706
|
+
{ name: "value", key: "value", type: "integer" },
|
|
707
|
+
],
|
|
708
|
+
[[null, 100, true, true]],
|
|
709
|
+
);
|
|
710
|
+
|
|
711
|
+
const result = toValueDiffGrid(df, ["id"]);
|
|
712
|
+
|
|
713
|
+
expect(result.rows).toHaveLength(1);
|
|
714
|
+
expect(result.rows[0].id).toBeNull();
|
|
715
|
+
});
|
|
716
|
+
|
|
717
|
+
test("handles single row DataFrame", () => {
|
|
718
|
+
const df = createJoinedDataFrame(
|
|
719
|
+
[{ name: "id", key: "id", type: "integer" }],
|
|
720
|
+
[[1, true, true]],
|
|
721
|
+
);
|
|
722
|
+
|
|
723
|
+
const result = toValueDiffGrid(df, ["id"]);
|
|
724
|
+
|
|
725
|
+
expect(result.rows).toHaveLength(1);
|
|
726
|
+
});
|
|
727
|
+
|
|
728
|
+
test("handles DataFrame with only in_a/in_b and primary key columns", () => {
|
|
729
|
+
const df: DataFrame = {
|
|
730
|
+
columns: [
|
|
731
|
+
{ name: "id", key: "id", type: "integer" },
|
|
732
|
+
{ name: "in_a", key: "in_a", type: "boolean" },
|
|
733
|
+
{ name: "in_b", key: "in_b", type: "boolean" },
|
|
734
|
+
],
|
|
735
|
+
data: [
|
|
736
|
+
[1, true, true],
|
|
737
|
+
[2, true, false],
|
|
738
|
+
],
|
|
739
|
+
};
|
|
740
|
+
|
|
741
|
+
const result = toValueDiffGrid(df, ["id"]);
|
|
742
|
+
|
|
743
|
+
expect(result.rows).toHaveLength(2);
|
|
744
|
+
// Should only have the id column (in_a/in_b excluded)
|
|
745
|
+
expect(result.columns.length).toBe(1);
|
|
746
|
+
});
|
|
747
|
+
|
|
748
|
+
test("handles boolean values correctly", () => {
|
|
749
|
+
const df = createJoinedDataFrame(
|
|
750
|
+
[
|
|
751
|
+
{ name: "id", key: "id", type: "integer" },
|
|
752
|
+
{ name: "active", key: "active", type: "boolean" },
|
|
753
|
+
],
|
|
754
|
+
[
|
|
755
|
+
[1, true, true, false], // base has active=true
|
|
756
|
+
[1, false, false, true], // current has active=false
|
|
757
|
+
],
|
|
758
|
+
);
|
|
759
|
+
|
|
760
|
+
const result = toValueDiffGrid(df, ["id"]);
|
|
761
|
+
|
|
762
|
+
expect(result.rows[0].__status).toBe("modified");
|
|
763
|
+
expect(result.rows[0].base__active).toBe(true);
|
|
764
|
+
expect(result.rows[0].current__active).toBe(false);
|
|
765
|
+
});
|
|
766
|
+
|
|
767
|
+
test("handles float values", () => {
|
|
768
|
+
const df = createJoinedDataFrame(
|
|
769
|
+
[
|
|
770
|
+
{ name: "id", key: "id", type: "integer" },
|
|
771
|
+
{ name: "price", key: "price", type: "number" },
|
|
772
|
+
],
|
|
773
|
+
[[1, 19.99, true, true]],
|
|
774
|
+
);
|
|
775
|
+
|
|
776
|
+
const result = toValueDiffGrid(df, ["id"]);
|
|
777
|
+
|
|
778
|
+
expect(result.rows[0].base__price).toBe(19.99);
|
|
779
|
+
expect(result.rows[0].current__price).toBe(19.99);
|
|
780
|
+
});
|
|
781
|
+
});
|
|
782
|
+
|
|
783
|
+
// ============================================================================
|
|
784
|
+
// Primary Key Column Output Tests
|
|
785
|
+
// ============================================================================
|
|
786
|
+
|
|
787
|
+
describe("toValueDiffGrid - Primary Key Column Output", () => {
|
|
788
|
+
test("primary key values are not prefixed with base__/current__", () => {
|
|
789
|
+
const df = createJoinedDataFrame(
|
|
790
|
+
[
|
|
791
|
+
{ name: "id", key: "id", type: "integer" },
|
|
792
|
+
{ name: "value", key: "value", type: "integer" },
|
|
793
|
+
],
|
|
794
|
+
[[1, 100, true, true]],
|
|
795
|
+
);
|
|
796
|
+
|
|
797
|
+
const result = toValueDiffGrid(df, ["id"]);
|
|
798
|
+
|
|
799
|
+
// PK should be at row.id, not row.base__id or row.current__id
|
|
800
|
+
expect(result.rows[0].id).toBe(1);
|
|
801
|
+
expect(result.rows[0].base__id).toBeUndefined();
|
|
802
|
+
expect(result.rows[0].current__id).toBeUndefined();
|
|
803
|
+
|
|
804
|
+
// Non-PK columns should be prefixed
|
|
805
|
+
expect(result.rows[0].base__value).toBe(100);
|
|
806
|
+
expect(result.rows[0].current__value).toBe(100);
|
|
807
|
+
});
|
|
808
|
+
|
|
809
|
+
test("multiple primary key columns are not prefixed", () => {
|
|
810
|
+
const df = createJoinedDataFrame(
|
|
811
|
+
[
|
|
812
|
+
{ name: "region", key: "region", type: "text" },
|
|
813
|
+
{ name: "product", key: "product", type: "text" },
|
|
814
|
+
{ name: "sales", key: "sales", type: "integer" },
|
|
815
|
+
],
|
|
816
|
+
[["US", "Widget", 100, true, true]],
|
|
817
|
+
);
|
|
818
|
+
|
|
819
|
+
const result = toValueDiffGrid(df, ["region", "product"]);
|
|
820
|
+
|
|
821
|
+
// PKs should be unprefixed (lowercase)
|
|
822
|
+
expect(result.rows[0].region).toBe("US");
|
|
823
|
+
expect(result.rows[0].product).toBe("Widget");
|
|
824
|
+
|
|
825
|
+
// Non-PK should be prefixed
|
|
826
|
+
expect(result.rows[0].base__sales).toBe(100);
|
|
827
|
+
expect(result.rows[0].current__sales).toBe(100);
|
|
828
|
+
});
|
|
829
|
+
|
|
830
|
+
test("primary key columns are frozen in output", () => {
|
|
831
|
+
const df = createJoinedDataFrame(
|
|
832
|
+
[
|
|
833
|
+
{ name: "id", key: "id", type: "integer" },
|
|
834
|
+
{ name: "value", key: "value", type: "integer" },
|
|
835
|
+
],
|
|
836
|
+
[[1, 100, true, true]],
|
|
837
|
+
);
|
|
838
|
+
|
|
839
|
+
const result = toValueDiffGrid(df, ["id"]);
|
|
840
|
+
|
|
841
|
+
// Find the id column and check if it's frozen
|
|
842
|
+
const idColumn = result.columns.find(
|
|
843
|
+
(col) => "field" in col && col.field === "id",
|
|
844
|
+
);
|
|
845
|
+
|
|
846
|
+
expect(idColumn).toBeDefined();
|
|
847
|
+
if (idColumn && "pinned" in idColumn) {
|
|
848
|
+
expect(idColumn.pinned).toBe("left");
|
|
849
|
+
}
|
|
850
|
+
});
|
|
851
|
+
});
|
|
852
|
+
|
|
853
|
+
// ============================================================================
|
|
854
|
+
// Performance Tests
|
|
855
|
+
// ============================================================================
|
|
856
|
+
|
|
857
|
+
describe("toValueDiffGrid - Performance", () => {
|
|
858
|
+
test("handles 500 rows efficiently", () => {
|
|
859
|
+
const generateData = (count: number) =>
|
|
860
|
+
Array.from({ length: count }, (_, i) => [
|
|
861
|
+
i,
|
|
862
|
+
`Name ${i}`,
|
|
863
|
+
i * 10,
|
|
864
|
+
i % 3 === 0, // some in base
|
|
865
|
+
i % 2 === 0, // some in current
|
|
866
|
+
]);
|
|
867
|
+
|
|
868
|
+
const df = createJoinedDataFrame(
|
|
869
|
+
[
|
|
870
|
+
{ name: "id", key: "id", type: "integer" },
|
|
871
|
+
{ name: "name", key: "name", type: "text" },
|
|
872
|
+
{ name: "value", key: "value", type: "integer" },
|
|
873
|
+
],
|
|
874
|
+
generateData(500),
|
|
875
|
+
);
|
|
876
|
+
|
|
877
|
+
const startTime = performance.now();
|
|
878
|
+
const result = toValueDiffGrid(df, ["id"]);
|
|
879
|
+
const endTime = performance.now();
|
|
880
|
+
|
|
881
|
+
expect(result.rows.length).toBeGreaterThan(0);
|
|
882
|
+
expect(endTime - startTime).toBeLessThan(1000); // Should complete in under 1 second
|
|
883
|
+
});
|
|
884
|
+
});
|