diff --git a/apps/web-remix/app/components/fileUpload/FileUploadListPreview.tsx b/apps/web-remix/app/components/fileUpload/FileUploadListPreview.tsx index b32e87ef3..ffba4119b 100644 --- a/apps/web-remix/app/components/fileUpload/FileUploadListPreview.tsx +++ b/apps/web-remix/app/components/fileUpload/FileUploadListPreview.tsx @@ -5,7 +5,9 @@ import { ItemList } from "~/components/list/ItemList"; import { IFileUpload, IPreviewProps } from "./fileUpload.types"; import { IconButton } from "~/components/iconButton"; -interface FileUploadListPreviewProps extends Omit { +interface FileUploadListPreviewProps + extends Omit, + React.HTMLProps { remove?: (id: number) => Promise; disabled?: boolean; className?: string; @@ -15,6 +17,7 @@ export function FileUploadListPreview({ remove, className, disabled, + ...rest }: FileUploadListPreviewProps) { return ( ( )} + {...rest} /> ); } diff --git a/apps/web-remix/app/components/pages/pipelines/CustomNodes/NodeFieldsForm.tsx b/apps/web-remix/app/components/pages/pipelines/CustomNodes/NodeFieldsForm.tsx index 2f12f775d..646372dbf 100644 --- a/apps/web-remix/app/components/pages/pipelines/CustomNodes/NodeFieldsForm.tsx +++ b/apps/web-remix/app/components/pages/pipelines/CustomNodes/NodeFieldsForm.tsx @@ -176,6 +176,7 @@ export function NodeFieldsForm({ preview={(props) => ( diff --git a/apps/web-remix/app/tests/integrations/auth/login.handlers.ts b/apps/web-remix/app/tests/__tests__/auth/login.handlers.ts similarity index 100% rename from apps/web-remix/app/tests/integrations/auth/login.handlers.ts rename to apps/web-remix/app/tests/__tests__/auth/login.handlers.ts diff --git a/apps/web-remix/app/tests/integrations/auth/login.test.tsx b/apps/web-remix/app/tests/__tests__/auth/login.test.tsx similarity index 100% rename from apps/web-remix/app/tests/integrations/auth/login.test.tsx rename to apps/web-remix/app/tests/__tests__/auth/login.test.tsx diff --git a/apps/web-remix/app/tests/integrations/auth/register.handlers.ts b/apps/web-remix/app/tests/__tests__/auth/register.handlers.ts similarity index 100% rename from apps/web-remix/app/tests/integrations/auth/register.handlers.ts rename to apps/web-remix/app/tests/__tests__/auth/register.handlers.ts diff --git a/apps/web-remix/app/tests/integrations/auth/register.test.tsx b/apps/web-remix/app/tests/__tests__/auth/register.test.tsx similarity index 100% rename from apps/web-remix/app/tests/integrations/auth/register.test.tsx rename to apps/web-remix/app/tests/__tests__/auth/register.test.tsx diff --git a/apps/web-remix/app/tests/integrations/knowledge/knowledgeBase.test.tsx b/apps/web-remix/app/tests/__tests__/knowledge/knowledgeBase.test.tsx similarity index 100% rename from apps/web-remix/app/tests/integrations/knowledge/knowledgeBase.test.tsx rename to apps/web-remix/app/tests/__tests__/knowledge/knowledgeBase.test.tsx diff --git a/apps/web-remix/app/tests/integrations/organizations/onboarding.test.tsx b/apps/web-remix/app/tests/__tests__/organizations/onboarding.test.tsx similarity index 100% rename from apps/web-remix/app/tests/integrations/organizations/onboarding.test.tsx rename to apps/web-remix/app/tests/__tests__/organizations/onboarding.test.tsx diff --git a/apps/web-remix/app/tests/integrations/pipelines/build.test.tsx b/apps/web-remix/app/tests/__tests__/pipelines/build.test.tsx similarity index 92% rename from apps/web-remix/app/tests/integrations/pipelines/build.test.tsx rename to apps/web-remix/app/tests/__tests__/pipelines/build.test.tsx index 6c2994044..fbf551446 100644 --- a/apps/web-remix/app/tests/integrations/pipelines/build.test.tsx +++ b/apps/web-remix/app/tests/__tests__/pipelines/build.test.tsx @@ -45,13 +45,18 @@ import { ModelsHandlers, } from "~/tests/handlers/model.handlers"; import { RadioHandle } from "~/tests/handles/Radio.handle"; -import { CollectionHandlers } from "~/tests/handlers/collection.handlers"; +import { + CollectionHandlers, + CollectionMemoriesHandlers, +} from "~/tests/handlers/collection.handlers"; import { pipelineFixture } from "~/tests/fixtures/pipeline.fixtures"; import { aliasFixture } from "~/tests/fixtures/alias.fixtures"; import { collectionFixture } from "~/tests/fixtures/collection.fixtures"; import { embeddingFixture } from "~/tests/fixtures/embedding.fixtures"; import { modelFixture } from "~/tests/fixtures/models.fixtures"; import { secretFixture } from "~/tests/fixtures/secrets.fixtures"; +import { collectionMemoryFixtures } from "~/tests/fixtures/collectionMemory.fixtures"; +import { ListHandle } from "~/tests/handles/List.handle"; const handlers = () => [ ...blockTypesHandlers(), @@ -71,6 +76,10 @@ const handlers = () => [ collectionFixture(), collectionFixture({ id: 2, name: "super-collection" }), ]).handlers, + ...new CollectionMemoriesHandlers([ + collectionMemoryFixtures(), + collectionMemoryFixtures({ id: 2, file_name: "test_file" }), + ]).handlers, ...new PipelineHandlers([ pipelineFixture(), pipelineFixture({ id: 2, name: "sample-workflow" }), @@ -419,6 +428,36 @@ describe(PipelineBuilder.name, () => { expect(knowledgeSelect.value).toBe("NEW_NEW"); }); + test("should reload memory files after changing knowledge base", async () => { + const page = new PipelineObject().render({ + initialEntries: [`/2/pipelines/2/build`], + }); + + const list = await ListHandle.fromLabelText( + /document_search_1 memory list/i + ); + expect(list.children).toHaveLength(0); + + const editButton = await ButtonHandle.fromLabelText( + /Edit block: document_search_1/i + ); + await page.fireBlockOnClick(editButton.buttonElement); + + const knowledgeSelect = await SelectHandle.fromTestId("opts.knowledge"); + await knowledgeSelect.selectOption("super-collection"); + + const submit = await ButtonHandle.fromRole("Save changes"); + await waitFor(async () => { + await submit.click(); + }); + + const listAfterUpdate = await ListHandle.fromLabelText( + /document_search_1 memory list/i + ); + + expect(listAfterUpdate.children).toHaveLength(2); + }); + test("should clear model and endpoint after changing API type", async () => { new PipelineObject().render({ initialEntries: [ diff --git a/apps/web-remix/app/tests/integrations/pipelines/pipelines.test.tsx b/apps/web-remix/app/tests/__tests__/pipelines/pipelines.test.tsx similarity index 100% rename from apps/web-remix/app/tests/integrations/pipelines/pipelines.test.tsx rename to apps/web-remix/app/tests/__tests__/pipelines/pipelines.test.tsx diff --git a/apps/web-remix/app/tests/handles/List.handle.ts b/apps/web-remix/app/tests/handles/List.handle.ts index a064c2c9b..01ed5a016 100644 --- a/apps/web-remix/app/tests/handles/List.handle.ts +++ b/apps/web-remix/app/tests/handles/List.handle.ts @@ -8,6 +8,6 @@ export class ListHandle { } get children() { - return this.listElement.children; + return [...this.listElement.children]; } } diff --git a/apps/web-remix/vite.config.ts b/apps/web-remix/vite.config.ts index 96506307a..f67af60b7 100644 --- a/apps/web-remix/vite.config.ts +++ b/apps/web-remix/vite.config.ts @@ -11,6 +11,9 @@ export default defineConfig({ }, server: { port: 3000, + watch: { + ignored: ["**/__tests__", "**/*.(test|spec).(ts|tsx|js|jsx)"], + }, }, plugins: [ tsconfigPaths(),