test(grid): pin oracle blob copy-as-sql hex behavior

This commit is contained in:
ordinary being
2026-10-19 14:32:15 +08:00
committed by GitHub
parent bf9bb3fc47
commit 4952707bbb
@@ -2976,5 +2976,15 @@ describe("useDataGridExport MySQL BLOB 文本复制 (#12413)", () => {
expect(extractDataGridSelection).toHaveBeenCalledWith(expect.objectContaining({ extractor: "raw", rows: [["abc"]] }));
expect(copyToClipboard).toHaveBeenCalledWith("abc");
// The SQL extractor keeps the canonical hex even for a text-like blob, mirroring
// the MySQL #12413 case: copy-as-INSERT must not decode bytes (#12679 review).
const sqlMatrix: CellSelectionMatrix = { rowIndexes: [0], columnIndexes: [1], columns: ["secret"], rows: [["0x616263"]] };
vi.mocked(extractDataGridSelection).mockResolvedValueOnce({ text: "INSERT INTO `test_blob` (`secret`) VALUES (0x616263);", mimeType: "application/sql", fileExtension: "sql", rowCount: 1, columnCount: 1 });
const sqlState = createExportState(blobTable, ["id", "secret"], sqlMatrix, [1, "0x616263"], undefined, undefined, [], DEFAULT_DATA_GRID_EXTRACTOR_OPTIONS, false, undefined, false, 1, 1, "oracle");
await expect(sqlState.copyWithExtractor("sql-inserts")).resolves.toBe(true);
expect(extractDataGridSelection).toHaveBeenLastCalledWith(expect.objectContaining({ extractor: "sql-inserts", rows: [[1, "0x616263"]] }));
});
});