import { describe, expect, it } from "vitest"; import { parseLLMText } from "../parseLLMText.js"; import * as fs from "node:fs"; import path from "node:path"; describe("parseLLMText", () => { it("정상적으로 파싱한다", async () => { const data = fs.readFileSync( path.join(__dirname, "data", "test_llms.txt"), "utf-8" ); const parsed = parseLLMText(data); expect(parsed.length).toBeGreaterThan(0); }); it("마크다운 링크 형식이 아니어서 유효한 URL을 추출할 수 없는 라인은 스킵한다", () => { const data = [ "> 기본 URL: https://docs.tosspayments.com", "- [가이드](https://docs.tosspayments.com/guides/v2/billing.md): 설명", ].join("\n"); const parsed = parseLLMText(data); expect(parsed).toHaveLength(1); expect(parsed[0].link).toBe( "https://docs.tosspayments.com/guides/v2/billing.md" ); }); });