OpenRAG is a comprehensive, single package Retrieval-Augmented Generation platform built on Langflow, Docling, and Opensearch.
Python
import { describe, expect, it } from "vitest";
import { normalizeFrontendBasePath } from "./frontend-base-path";
describe("normalizeFrontendBasePath", () => {
it.each([
[undefined, ""],
["", ""],
["/", ""],
[" / ", ""],
["openrag-fe", "/openrag-fe"],
[" /openrag-fe/ ", "/openrag-fe"],
["/platform/openrag-fe///", "/platform/openrag-fe"],
["/r-d_ui", "/r-d_ui"],
])("normalizes %j to %j", (value, expected) => {
expect(normalizeFrontendBasePath(value)).toBe(expected);
});
it.each([
"https://example.com/openrag-fe",
"/openrag-fe?tab=1",
"/x#y",
"//wrong-origin",
"/r&d|ui",
"/bad\\path",
"/a//b",
"/a/../b",
"/a/./b",
"/bad path",
"/bad\npath",
])("rejects an invalid path (%s)", (value) => {
expect(() => normalizeFrontendBasePath(value)).toThrow(
"OPENRAG_FRONTEND_BASE_PATH",
);
});
});