From aeefc77da01442f2fc6018b2cda3deeb0e12997a Mon Sep 17 00:00:00 2001 From: Alex Yang Date: Wed, 24 Apr 2024 15:04:29 -0500 Subject: [PATCH] test: load large amount of data won't cause error (#762) --- .../ingestion/ingestion-pipeline.test.ts | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 packages/core/tests/ingestion/ingestion-pipeline.test.ts diff --git a/packages/core/tests/ingestion/ingestion-pipeline.test.ts b/packages/core/tests/ingestion/ingestion-pipeline.test.ts new file mode 100644 index 000000000..746741803 --- /dev/null +++ b/packages/core/tests/ingestion/ingestion-pipeline.test.ts @@ -0,0 +1,22 @@ +import { Document } from "llamaindex/Node"; +import { IngestionPipeline } from "llamaindex/ingestion/IngestionPipeline"; +import { test } from "vitest"; + +// Refs: https://github.com/run-llama/LlamaIndexTS/pull/760 +test("load large data should not cause RangeError #760", async () => { + const pipeline = new IngestionPipeline({ + reader: { + loadData: async () => { + return Array.from( + { length: 1e6 }, + (_, i) => + new Document({ + id_: `${i}`, + text: "some text", + }), + ); + }, + }, + }); + await pipeline.prepareInput(); +});