feat(query): move grid save prep to Rust
This commit is contained in:
1 parent
56aeed79fc
commit
209eff528d
14 files changed
+1448
-1092
No files matched your search
@@ -0,0 +1,32 @@
|
||||
import { readFileSync } from "node:fs";
|
||||
import { strict as assert } from "node:assert";
|
||||
import test from "node:test";
|
||||
|
||||
const apiSource = readFileSync("apps/desktop/src/lib/api.ts", "utf8");
|
||||
const tauriSource = readFileSync("apps/desktop/src/lib/tauri.ts", "utf8");
|
||||
const httpSource = readFileSync("apps/desktop/src/lib/http.ts", "utf8");
|
||||
const editorSource = readFileSync("apps/desktop/src/composables/useDataGridEditor.ts", "utf8");
|
||||
const tauriLibSource = readFileSync("src-tauri/src/lib.rs", "utf8");
|
||||
const webMainSource = readFileSync("crates/dbx-web/src/main.rs", "utf8");
|
||||
const rustCoreLibSource = readFileSync("crates/dbx-core/src/lib.rs", "utf8");
|
||||
|
||||
test("shared API exposes backend data grid save preparation", () => {
|
||||
assert.match(apiSource, /export const prepareDataGridSave = forward\("prepareDataGridSave"\)/);
|
||||
assert.match(tauriSource, /export async function prepareDataGridSave\(/);
|
||||
assert.match(tauriSource, /invoke\("prepare_data_grid_save"/);
|
||||
assert.match(httpSource, /export async function prepareDataGridSave\(/);
|
||||
assert.match(httpSource, /\/api\/query\/prepare-data-grid-save/);
|
||||
});
|
||||
|
||||
test("data grid save flow uses backend save preparation", () => {
|
||||
assert.match(editorSource, /await api\.prepareDataGridSave\(stmtOptions\)/);
|
||||
assert.doesNotMatch(editorSource, /buildDataGridSaveStatements\(/);
|
||||
assert.doesNotMatch(editorSource, /buildDataGridRollbackStatements\(/);
|
||||
assert.doesNotMatch(editorSource, /validateDataGridSave\(/);
|
||||
});
|
||||
|
||||
test("Rust backends register data grid save preparation", () => {
|
||||
assert.match(rustCoreLibSource, /pub mod data_grid_sql/);
|
||||
assert.match(tauriLibSource, /commands::query::prepare_data_grid_save/);
|
||||
assert.match(webMainSource, /\/query\/prepare-data-grid-save/);
|
||||
});
|
||||
Reference in new issue
Block a user