Skip to content

Commit 1b86e22

Browse files
committed
fix: fragment-do test mock returns valid empty QMCB instead of null
1 parent 8a47c81 commit 1b86e22

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

src/fragment-do.test.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,15 @@ vi.mock("./wasm-engine.js", () => ({
2222
registerColumns: () => true,
2323
registerDecodedColumns: () => true,
2424
executeQuery: () => [],
25-
executeQueryColumnar: () => null,
25+
executeQueryColumnar: () => {
26+
// Return empty QMCB: magic(4) + rowCount=0(4) + colCount=0(2) = 10 bytes
27+
const buf = new ArrayBuffer(10);
28+
const view = new DataView(buf);
29+
view.setUint32(0, 0x42434D51, true); // "QMCB"
30+
view.setUint32(4, 0, true); // 0 rows
31+
view.setUint16(8, 0, true); // 0 columns
32+
return buf;
33+
},
2634
vectorSearchBuffer: () => ({ indices: new Uint32Array(0), scores: new Float32Array(0) }),
2735
cacheGet: () => null,
2836
cacheSet: () => false,

0 commit comments

Comments
 (0)