Skip to content

Commit

Permalink
Ignore tests files in server watch options
Browse files Browse the repository at this point in the history
  • Loading branch information
kielbasa-elp committed Feb 24, 2024
1 parent a2239fd commit 42a660e
Show file tree
Hide file tree
Showing 12 changed files with 50 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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<IPreviewProps, "remove"> {
interface FileUploadListPreviewProps
extends Omit<IPreviewProps, "remove">,
React.HTMLProps<HTMLUListElement> {
remove?: (id: number) => Promise<void>;
disabled?: boolean;
className?: string;
Expand All @@ -15,6 +17,7 @@ export function FileUploadListPreview({
remove,
className,
disabled,
...rest
}: FileUploadListPreviewProps) {
return (
<ItemList
Expand All @@ -27,6 +30,7 @@ export function FileUploadListPreview({
renderItem={(file) => (
<FileUploadListItem file={file} onRemove={remove} disabled={disabled} />
)}
{...rest}
/>
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ export function NodeFieldsForm({
preview={(props) => (
<FileUploadListPreview
{...props}
aria-label={`${blockName} memory list`}
className="max-h-[110px]"
disabled={disabled}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand All @@ -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" }),
Expand Down Expand Up @@ -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: [
Expand Down
2 changes: 1 addition & 1 deletion apps/web-remix/app/tests/handles/List.handle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ export class ListHandle {
}

get children() {
return this.listElement.children;
return [...this.listElement.children];
}
}
3 changes: 3 additions & 0 deletions apps/web-remix/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ export default defineConfig({
},
server: {
port: 3000,
watch: {
ignored: ["**/__tests__", "**/*.(test|spec).(ts|tsx|js|jsx)"],
},
},
plugins: [
tsconfigPaths(),
Expand Down

0 comments on commit 42a660e

Please sign in to comment.