UI fixes unit tests

This commit is contained in:
Ishaan Jaffer 2026-01-26 17:30:58 -08:00
parent ce9a237c2e
commit a45fc07dae
3 changed files with 12 additions and 11 deletions

View file

@ -70,7 +70,7 @@ describe("DocumentsTable", () => {
const onRemove = vi.fn();
render(<DocumentsTable documents={mockDocuments} onRemove={onRemove} />);
const deleteButtons = screen.getAllByLabelText(/remove/i);
const deleteButtons = screen.getAllByLabelText(/delete/i);
act(() => {
fireEvent.click(deleteButtons[0]);
@ -91,9 +91,9 @@ describe("DocumentsTable", () => {
render(<DocumentsTable documents={mockDocuments} onRemove={onRemove} />);
// Each document should have 3 action buttons (view, copy, delete)
const viewButtons = screen.getAllByLabelText(/view details/i);
const copyButtons = screen.getAllByLabelText(/copy id/i);
const deleteButtons = screen.getAllByLabelText(/remove/i);
const viewButtons = screen.getAllByLabelText(/eye/i);
const copyButtons = screen.getAllByLabelText(/copy/i);
const deleteButtons = screen.getAllByLabelText(/delete/i);
expect(viewButtons).toHaveLength(3);
expect(copyButtons).toHaveLength(3);

View file

@ -83,7 +83,8 @@ describe("TestVectorStoreTab", () => {
const selectElement = screen.getByRole("combobox");
fireEvent.mouseDown(selectElement);
expect(screen.getByText("Test Store 1")).toBeInTheDocument();
// Use getAllByText since the selected value also shows the name
expect(screen.getAllByText("Test Store 1").length).toBeGreaterThan(0);
expect(screen.getByText("Test Store 2")).toBeInTheDocument();
});
});

View file

@ -130,9 +130,9 @@ describe("VectorStoreTable", () => {
expect(screen.getByText("Provider")).toBeInTheDocument();
expect(screen.getByText("Created At")).toBeInTheDocument();
expect(screen.getByText("Updated At")).toBeInTheDocument();
// Check that we have the expected number of header cells (6 data + 1 actions)
// Check that we have the expected number of header cells (7 data + 1 actions)
const headers = screen.getAllByRole("columnheader");
expect(headers).toHaveLength(7);
expect(headers).toHaveLength(8);
});
it("should render all vector store rows", () => {
@ -183,7 +183,7 @@ describe("VectorStoreTable", () => {
it("should render fallback for missing name", () => {
renderComponent();
const fallbackElements = screen.getAllByText("-");
expect(fallbackElements.length).toBe(2); // One for missing name, one for missing description
expect(fallbackElements.length).toBe(3); // One for missing name, one for missing description, one for missing files
});
it("should wrap name in tooltip", () => {
@ -203,7 +203,7 @@ describe("VectorStoreTable", () => {
it("should render fallback for missing description", () => {
renderComponent();
const fallbackElements = screen.getAllByText("-");
expect(fallbackElements.length).toBe(2); // One for missing name, one for missing description
expect(fallbackElements.length).toBe(3); // One for missing name, one for missing description, one for missing files
});
it("should wrap description in tooltip", () => {
@ -386,7 +386,7 @@ describe("VectorStoreTable", () => {
it("should span all columns in empty state", () => {
renderComponent({ data: [] });
const emptyCell = screen.getByText("No vector stores found").closest("td");
expect(emptyCell).toHaveAttribute("colSpan", "7"); // 6 data columns + 1 actions column
expect(emptyCell).toHaveAttribute("colSpan", "8"); // 7 data columns + 1 actions column
});
});
@ -403,7 +403,7 @@ describe("VectorStoreTable", () => {
renderComponent({ data: minimalData });
expect(screen.getByText("minimal")).toBeInTheDocument();
expect(screen.getAllByText("-")).toHaveLength(2); // Name and description fallbacks
expect(screen.getAllByText("-")).toHaveLength(3); // Name, description, and files fallbacks
});
it("should handle single vector store", () => {