25 MB lightweight cross-platform database client for 100+ databases, including MySQL, PostgreSQL, SQLite, Redis, MongoDB, DuckDB, SQL Server, and Dameng. Built-in AI, MCP Server, CLI, desktop and Docker. | 轻量级跨平台数据库管理工具,支持 MySQL、PostgreSQL、SQLite、Redis、MongoDB、达梦等 100+ 数据库,提供桌面端、Docker、CLI、内置 AI 助手和 MCP。
TypeScript aicliclickhousedatabasedatabase-clientdatabase-managementdockerguimcpmongodbmysqlpostgresqlredisrustsql-serversqlitetaurivue
fix(ci): fix broken tests after external-sql and xlsx changes
t8y25522842b19d5
diff --git a/apps/desktop/src/stores/queryStore.ts b/apps/desktop/src/stores/queryStore.tsindex b3b3714e39..262f876dfe 100644--- a/apps/desktop/src/stores/queryStore.ts+++ b/apps/desktop/src/stores/queryStore.ts@@ -536,6 +536,18 @@ export const useQueryStore = defineStore("query", () => {{ flush: "post" },);+ // Immediately flush any pending debounced persist so the on-disk content+ // reflects the latest in-memory tabs without waiting for the 300ms debounce.+ // Lets callers (e.g. tests that reload the store) read back persisted state+ // deterministically instead of racing the debounce timer.+ function flushPendingPersist() {+ if (_persistTimer) {+ clearTimeout(_persistTimer);+ _persistTimer = null;+ }+ saveTabs(tabs.value, activeTabId.value);+ }+function findTabByIdentity(connectionId: string, database: string, title: string, mode: QueryTab["mode"], schema?: string) {return tabs.value.find((tab) => tab.connectionId === connectionId && tab.database === database && tab.title === title && tab.mode === mode && (tab.schema || "") === (schema || ""));}@@ -2319,6 +2331,7 @@ export const useQueryStore = defineStore("query", () => {closeTab,forceClosePendingTab,cancelClosePendingTab,+ flushPendingPersist,saveAndClosePendingTab,isTabDirty,markTabClean,diff --git a/crates/dbx-core/src/table_export.rs b/crates/dbx-core/src/table_export.rsindex 8002425c3f..da6e41f0c2 100644--- a/crates/dbx-core/src/table_export.rs+++ b/crates/dbx-core/src/table_export.rs@@ -647,6 +647,16 @@ mod tests {use crate::database_export::{clear_export_cancelled, set_export_cancelled};use crate::xlsx_export::{build_xlsx_workbook, XlsxWorksheetData};use serde_json::json;+ use std::io::Read;++ /// Read and decompress a single entry from an in-memory XLSX (ZIP) buffer.+ fn read_zip_entry(bytes: &[u8], path: &str) -> String {+ let mut archive = zip::ZipArchive::new(std::io::Cursor::new(bytes.to_vec())).expect("open xlsx as zip archive");+ let mut entry = archive.by_name(path).unwrap_or_else(|_| panic!("missing zip entry: {path}"));+ let mut content = String::new();+ entry.read_to_string(&mut content).expect("read zip entry");+ content+ }// -----------------------------------------------------------------------// Helper: check that two CSV strings are equivalent by splitting lines@@ -766,15 +776,16 @@ mod tests {],};let workbook = build_xlsx_workbook(&data).expect("XLSX build should succeed");- let text = String::from_utf8_lossy(&workbook);assert_eq!(workbook[0], 0x50, "Should be a ZIP (PK) archive");assert_eq!(workbook[1], 0x4b);- assert!(text.contains("[Content_Types].xml"));- assert!(text.contains("xl/worksheets/sheet1.xml"));- assert!(text.contains("name=\"employees\""));- assert!(text.contains("<v>75000.5</v>"));- assert!(text.contains("Alice"));++ // Entries are Deflate-compressed; assert on their decompressed contents.+ let workbook_xml = read_zip_entry(&workbook, "xl/workbook.xml");+ let sheet = read_zip_entry(&workbook, "xl/worksheets/sheet1.xml");+ assert!(workbook_xml.contains("name=\"employees\""));+ assert!(sheet.contains("<v>75000.5</v>"));+ assert!(sheet.contains("Alice"));}// -----------------------------------------------------------------------diff --git a/packages/app-tests/openTabsPersistence.test.ts b/packages/app-tests/openTabsPersistence.test.tsindex 59af1b0850..e88351f0db 100644--- a/packages/app-tests/openTabsPersistence.test.ts+++ b/packages/app-tests/openTabsPersistence.test.ts@@ -32,6 +32,7 @@ test("serializes unsaved query tabs with editor context", () => {schema: "public",sql: "select * from users",savedSqlId: undefined,+ externalSqlPath: undefined,pinned: true,mode: "query",objectBrowser: undefined,diff --git a/packages/app-tests/queryStore.test.ts b/packages/app-tests/queryStore.test.tsindex a575418197..36809f9d40 100644--- a/packages/app-tests/queryStore.test.ts+++ b/packages/app-tests/queryStore.test.ts@@ -119,8 +119,7 @@ test("external SQL file paths persist with open query tabs", async () => {const tabId = store.createTab("conn-1", "db", "draft.sql");store.updateSql(tabId, "select 1;");store.linkExternalSqlPath(tabId, "/tmp/draft.sql", "draft.sql");-- await waitFor(() => !!globalThis.localStorage.getItem("dbx-open-tabs"), 1000);+ store.flushPendingPersist();setActivePinia(createPinia());store = useQueryStore();