test: tighten shared process map and model coverage

This commit is contained in:
Peter Steinberger 2026-03-13 21:36:32 +00:00
parent 2f82ade66f
commit fe55622205
2 changed files with 13 additions and 0 deletions

View File

@ -5,10 +5,13 @@ describe("shared/model-param-b", () => {
it("extracts the largest valid b-sized parameter token", () => {
expect(inferParamBFromIdOrName("llama-8b mixtral-22b")).toBe(22);
expect(inferParamBFromIdOrName("Qwen 0.5B Instruct")).toBe(0.5);
expect(inferParamBFromIdOrName("prefix M7B and q4_32b")).toBe(32);
});
it("ignores malformed, zero, and non-delimited matches", () => {
expect(inferParamBFromIdOrName("abc70beta 0b x70b2")).toBeNull();
expect(inferParamBFromIdOrName("model 0b")).toBeNull();
expect(inferParamBFromIdOrName("model b5")).toBeNull();
expect(inferParamBFromIdOrName("foo70bbar")).toBeNull();
});
});

View File

@ -26,4 +26,14 @@ describe("shared/process-scoped-map", () => {
expect(second).not.toBe(first);
});
it("reuses a prepopulated process map without replacing it", () => {
const existing = new Map<string, number>([["a", 1]]);
(process as unknown as Record<symbol, unknown>)[MAP_KEY] = existing;
const resolved = resolveProcessScopedMap<number>(MAP_KEY);
expect(resolved).toBe(existing);
expect(resolved.get("a")).toBe(1);
});
});