mirror of
https://github.com/run-llama/LlamaIndexTS.git
synced 2026-08-27 13:37:14 -04:00
25 lines
598 B
TypeScript
25 lines
598 B
TypeScript
import { Document } from "@llamaindex/core/schema";
|
|
import { HTMLNodeParser } from "@llamaindex/node-parser/html";
|
|
import { describe, expect, test } from "vitest";
|
|
|
|
describe("HTMLNodeParser", () => {
|
|
test("basic split", async () => {
|
|
const parser = new HTMLNodeParser();
|
|
const result = parser.getNodesFromDocuments([
|
|
new Document({
|
|
text: `<DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<title>Test</title>
|
|
</head>
|
|
<body>
|
|
<p>Hello World</p>
|
|
</body>
|
|
</html>`,
|
|
}),
|
|
]);
|
|
expect(result.length).toEqual(1);
|
|
expect(result[0]!.getContent()).toEqual("Hello World");
|
|
});
|
|
});
|