test(model): reuse empty GGUF fixture bytes (#17325)

This commit is contained in:
Vincent Koc
2026-12-06 08:35:03 +08:00
committed by GitHub
parent 0e3eff3498
commit b78b0b0cb5
2 changed files with 2 additions and 10 deletions
+1 -5
View File
@@ -994,13 +994,9 @@ cliTest(
);
const emptyGgufHeader = ggufFixture({ tensors: [], metadata: [] });
const alignedOffset = Math.ceil(emptyGgufHeader.header.length / 32) * 32;
const emptyGguf = Buffer.concat([
emptyGgufHeader.header,
Buffer.alloc(alignedOffset - emptyGgufHeader.header.length),
]);
for (const [name, bytes] of [
["optional.safetensors", safetensors.bytes],
["empty.gguf", emptyGguf],
["empty.gguf", emptyGgufHeader.bytes],
] as const) {
const path = join(root, name);
await writeFile(path, bytes);
+1 -5
View File
@@ -267,11 +267,7 @@ it.each([8, 24, 40])(
it("aligns the GGUF data section after an empty tensor directory", async () => {
const base = ggufFixture({ tensors: [], metadata: [] });
const dataOffset = Math.ceil(base.header.length / 32) * 32;
const bytes = Buffer.concat([
base.header,
Buffer.alloc(dataOffset - base.header.length),
]);
const report = await readFixtureHeader(bytes);
const report = await readFixtureHeader(base.bytes);
expect(report.tensors).toEqual([]);
expect(report.tensor_data_offset).toBe(dataOffset);
expect(report.artifact.header_length).toBe(base.header.length);