feat(extractor): configure INSERT quoting and portable temporal output
Closes #10559
This commit is contained in:
1 parent
a95762a536
commit
d4b4cf8279
13 files changed
+725
-20
No files matched your search
@@ -2,6 +2,16 @@ import { describe, expect, it } from "vitest";
|
||||
import { DEFAULT_DATA_GRID_EXTRACTOR_OPTIONS, normalizeDataGridCopyPreference, normalizeDataGridExtractorOptions, resolveDataGridCopyPreference, validateDataGridExtractorOptions } from "@/lib/dataGrid/dataGridCopyExtractor";
|
||||
|
||||
describe("data-grid extractor options", () => {
|
||||
it("preserves native SQL defaults and normalizes portable INSERT options", () => {
|
||||
for (const legacy of [undefined, {}, { sql: {} }, { sql: { insertMode: "row-by-row" } }]) {
|
||||
expect(normalizeDataGridExtractorOptions(legacy).sql).toMatchObject({ quoteIdentifiers: true, temporalFormat: "native" });
|
||||
}
|
||||
const configured = normalizeDataGridExtractorOptions({ sql: { quoteIdentifiers: false, temporalFormat: "string" } });
|
||||
expect(configured.sql).toMatchObject({ quoteIdentifiers: false, temporalFormat: "string" });
|
||||
expect(normalizeDataGridExtractorOptions(JSON.parse(JSON.stringify(configured)))).toEqual(configured);
|
||||
expect(normalizeDataGridExtractorOptions({ sql: { quoteIdentifiers: "false", temporalFormat: "custom" } }).sql).toMatchObject({ quoteIdentifiers: true, temporalFormat: "native" });
|
||||
});
|
||||
|
||||
it("keeps database qualification for legacy options and persists explicit opt-out", () => {
|
||||
expect(normalizeDataGridExtractorOptions({ sql: {} }).sql.includeDatabaseName).toBe(true);
|
||||
const configured = normalizeDataGridExtractorOptions({ sql: { includeDatabaseName: false } });
|
||||
|
||||
Reference in new issue
Block a user