/** * HF Storage Tests (Section 2 of TESTS.md) * * Tests the storage logic that can be tested without a real HF API. * Covers: getDatasetId, isHfStorageEnabled, setUserToken, sanitizeName. */ import { describe, it, expect } from "vitest"; import { getDatasetId, isHfStorageEnabled } from "../src/hf-storage.js"; import { sanitizeName } from "../src/utils.js"; describe("2.1 HF Storage configuration", () => { it("getDatasetId returns empty string without env vars", () => { expect(typeof getDatasetId()).toBe("string"); }); it("isHfStorageEnabled returns false without token or dataset", () => { if (!getDatasetId()) { expect(isHfStorageEnabled()).toBe(false); } }); it("sanitizeName produces safe filenames", () => { expect(sanitizeName("my-doc")).toBe("my-doc"); expect(sanitizeName("my doc!")).toBe("my_doc_"); expect(sanitizeName("../../etc")).toBe("______etc"); }); });