Skip to content

feat(resource-list): integrate API with TanStack Query and add detail page - #9

Open
LikithaYadavG wants to merge 3 commits into
feat/spinnerfrom
feat/resource-list-api-integration
Open

LikithaYadavG wants to merge 3 commits into
feat/spinnerfrom
feat/resource-list-api-integration

Conversation

@LikithaYadavG

Copy link
Copy Markdown
Collaborator

PR Template & Definition of Done

What does this PR do?

  • Integrates resource list page with API using TanStack Query for data fetching
  • Adds resource detail page with routing support
  • Adds filter mapping constants for resource types and skill levels
  • Refactors component variable names for better clarity in FilterDropdown and SearchBar

What steps does your reviewer have to take to test this PR manually?

  1. Run the application and navigate to the resource list page
  2. Verify search functionality filters resources via API
  3. Verify filter dropdowns (resource type, skill level) work correctly
  4. Click on a resource card to navigate to the detail page
  5. Verify loading spinner displays while fetching data
  6. Verify empty state displays when no resources match filters

Pull Request standards checklist - Please check off

  • This Branch will be carrying one single responsibility - feature/bugfix/style/refactor...
  • I have followed conventional commit messages and descriptive Branch naming.
  • My PR has descriptive folder/file names that I have worked on.

Testing checklist - Please check off

  • I have performed manual testing on my local to validate all changes.

If you have not followed and completed any of the above, please explain why below.
N/A

Definition of Done - Please check off

  • My code is well tested and I have confidence my code works as I expect in a variety of situations.
  • I have lint and format code is enabled when the file is saved and I have fixed all errors highlighted by lint.
  • I have deleted all non-descriptive comments and dead code from the files I've touched.
  • I have rebased my branch with the base branch I want to merge into and all the commits in this PR are my own.

@mergemitra

mergemitra Bot commented Jan 20, 2026

Copy link
Copy Markdown

Change Summary

This PR integrates the resource list UI with the backend API using TanStack Query (via useFilteredResources/useResourceById hooks) and adds a resource detail page with routing. It introduces mapping constants to translate UI filter labels to API enums, refactors some component handler variable names for clarity, and updates/extends tests to cover the new data-fetching behavior and UI states.

File Changes

File Summary
src/components/filter-dropdown/FilterDropdown.tsx Refactors option toggle handler parameter and variable names; updates onSelectionChange usage.
src/components/search-bar/SearchBar.tsx Renames search handlers and variables; updates input onChange and clear button handlers.
src/constants/resources.ts Adds FILTER_OPTIONS and maps RESOURCE_TYPE_MAP, SKILL_LEVEL_MAP for API filter mapping.
src/features/resource-list-page/ResourceDetailPage.test.tsx Adds tests for ResourceDetailPage covering loading, error, not-found, rendering details and back action.
src/features/resource-list-page/ResourceDetailPage.tsx New ResourceDetailPage using useResourceById hook; shows loading, error, not-found, and details.
src/features/resource-list-page/ResourceListPage.test.tsx Updates ResourceListPage tests to use react-query and API mocks; adds search/filter behavior tests.
src/features/resource-list-page/ResourceListPage.tsx Integrates resource list with API via useFilteredResources; introduces search and mapped filters; renders ResourceList.
src/features/resource-list-page/ResourceCard.test.tsx Adds tests for ResourceCard verifying rendering, navigation, external-link behavior, and accessibility label.
src/features/resource-list-page/components/ResourceCard.tsx Adds ResourceCard component that navigates to detail page, shows badges, tags, and external link.
src/features/resource-list-page/components/ResourceList.test.tsx Adds tests for ResourceList covering loading, empty state, and rendering resource cards.
src/features/resource-list-page/components/ResourceList.tsx Adds ResourceList component handling loading/empty states and rendering grid of ResourceCard.
src/routes/routes.tsx Registers new route 'resource/:id' and imports ResourceDetailPage.

@mergemitra

mergemitra Bot commented Jan 20, 2026

Copy link
Copy Markdown

PR Scorecard

Score

Communication Quality Code Correctness & Design Quality Test Quality & Coverage Code Readability & Maintainability
Scoring Methodology

Communication Scoring Framework

The overall communication score is a weighted average:

Dimension Weight Evaluates
PR Description Quality 60% Title format (conventional commits) + Description clarity (what changed & why)
PR Size & Scope 25% Appropriate sizing, scope cohesion, and justification for size
Commit Messages 15% Conventional commits format, atomic & descriptive changes

Formula: (Description x 0.6) + (PR Size x 0.25) + (Commits x 0.15)

Code Scoring Framework

The scorecard evaluates code using 3 key reviewer questions:

Reviewer Question Category
Is this the right solution, implemented the right way? Code Correctness
Would this catch bugs if the code broke tomorrow? Test Quality
Can someone new understand and safely modify this in 6 months? Maintainability
PR Communication Notes

Description Quality

  • ✅ Title follows conventional commits format with clear scope 'resource-list' and a descriptive summary.
  • ✅ Description follows the PR template and includes manual testing steps for list, filters, and detail page.
  • ❌ Description omits that many unit tests were added (ResourceListPage.test, ResourceDetailPage.test, ResourceCard.test); mention them for reviewer context.
  • ❌ Title has a leading space and is slightly over 72 chars; trim whitespace and shorten the title to ~72 chars.

PR Size & Scope

  • ✅ PR is focused on the resource-list feature and touches a cohesive set of files (components, pages, constants, tests).
  • ✅ Tests and component additions justify the larger size and increase confidence in behavior.
  • ❌ PR adds 781 lines; consider splitting future work (implementation vs extensive tests or multiple components) to simplify review.

Commit Messages

  • ✅ All commits follow conventional commits format and clearly indicate scope and intent.
  • ✅ Commit messages use meaningful scopes ('components', 'resource-list'), aiding review and changelog generation.

Notes

Code Correctness & Design Quality

  • 🟠 Unvalidated label→enum lookups at src/constants/resources.ts:19, src/features/resource-list-page/ResourceListPage.tsx:34 can produce undefined filters and send invalid params to the API
  • 🟠 Route path mismatch at src/features/resource-list-page/ResourceDetailPage.test.tsx:31, src/routes/routes.tsx:21, src/features/resource-list-page/components/ResourceCard.tsx:15 can make routing tests pass while the real app route breaks
  • 🟠 Passing id ?? "" into useResourceById at src/features/resource-list-page/ResourceDetailPage.tsx:13 can trigger fetches with an empty id and incorrect error/not-found handling
  • 🔴 Using React.ComponentProps without importing React/types at src/features/resource-list-page/components/ResourceCard.test.tsx:26 can break TypeScript compilation and prevent tests from running
  • 🔴 Missing expect import at src/features/resource-list-page/components/ResourceList.test.tsx:3 will cause runtime/compile failures and prevent tests from executing

Test Quality & Coverage

  • 🟠 Missing tests for filter→API mapping at src/features/resource-list-page/ResourceListPage.test.tsx:69 could let resource type/skill level regress without detection
  • 🟠 Asserting only navigate was called at src/features/resource-list-page/components/ResourceCard.test.tsx:104 could miss regressions where navigation targets the wrong URL

Code Readability & Maintainability

  • 🟠 Missing as const/derived label unions at src/constants/resources.ts:6 makes filter labels loosely typed and harder to refactor safely
  • 💬 Repeated inline resource fixtures at src/features/resource-list-page/ResourceDetailPage.test.tsx:75 increase test maintenance cost when the Resource shape changes
  • 💬 new Date(resource.created_at) at src/features/resource-list-page/ResourceDetailPage.tsx:56 lacks a fallback for invalid/empty dates, risking user-facing "Invalid Date" output
  • 💬 Several tests are marked async without awaits at src/features/resource-list-page/ResourceListPage.test.tsx:46 which adds noise and can hide missed async assertions
  • 💬 Using selectedFilters[filter.id] || [] at src/features/resource-list-page/ResourceListPage.tsx:64 should prefer ?? [] to avoid treating empty arrays as falsy if refactored
  • 🟠 Clickable card lacks guaranteed keyboard accessibility at src/features/resource-list-page/components/ResourceCard.tsx:19 which can block non-mouse users and a11y tooling
  • 💬 The click interaction test at src/features/resource-list-page/components/ResourceList.test.tsx:70 doesn’t assert an outcome, reducing its value and clarity

}));
};

const apiFilters: ResourceFilters = useMemo(() => {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Severity: 🟠 Major
Guard label→enum mappings so unknown labels never become undefined API filters, and tighten constants typing with as const.

Why this matters: With noUncheckedIndexedAccess-style safety, RESOURCE_TYPE_MAP[label] can be undefined, which can produce invalid query params and flaky filtering.

Suggested Change:

// src/constants/resources.ts
export const RESOURCE_TYPE_MAP = {
  Article: "article",
  Video: "video",
  Documentation: "docs",
  GitHub: "github",
} as const satisfies Record<string, ResourceType>;

export const SKILL_LEVEL_MAP = {
  Beginner: "beginner",
  Intermediate: "intermediate",
  Expert: "expert",
} as const satisfies Record<string, SkillLevel>;

type ResourceTypeLabel = keyof typeof RESOURCE_TYPE_MAP;
type SkillLevelLabel = keyof typeof SKILL_LEVEL_MAP;

export const isResourceTypeLabel = (label: string): label is ResourceTypeLabel =>
  label in RESOURCE_TYPE_MAP;
export const isSkillLevelLabel = (label: string): label is SkillLevelLabel =>
  label in SKILL_LEVEL_MAP;

// src/features/resource-list-page/ResourceListPage.tsx
const apiFilters: ResourceFilters = useMemo(() => {
  const selectedTypes = selectedFilters.resourceTypes ?? [];
  const selectedLevels = selectedFilters.skillLevels ?? [];

  return {
    searchQuery: searchQuery.trim() || undefined,
    types:
      selectedTypes.length > 0
        ? selectedTypes.filter(isResourceTypeLabel).map((l) => RESOURCE_TYPE_MAP[l])
        : undefined,
    levels:
      selectedLevels.length > 0
        ? selectedLevels.filter(isSkillLevelLabel).map((l) => SKILL_LEVEL_MAP[l])
        : undefined,
  };
}, [searchQuery, selectedFilters]);

user,
...render(
<QueryClientProvider client={queryClient}>
<MemoryRouter initialEntries={[`/resources/${resourceId}`]}>

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Severity: 🟠 Major
Align the test route (/resources/:id) with the actual app route (resource/:id) so routing behavior is validated correctly.

Suggested Change:

// Use the same route shape as src/routes/routes.tsx and ResourceCard navigation
<MemoryRouter initialEntries={[`/resource/${resourceId}`]}>
  <Routes>
    <Route path="/resource/:id" element={<ResourceDetailPage />} />
  </Routes>
</MemoryRouter>

Comment on lines +10 to +13
export const ResourceDetailPage = () => {
const { id } = useParams<{ id: string }>();
const navigate = useNavigate();
const { data: resource, isLoading, isError } = useResourceById(id ?? "");

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Severity: 🟠 Major
Avoid triggering useResourceById with an empty id by disabling the query (or otherwise guarding) when the route param is missing.

Why this matters: Fetching with "" can hit an invalid endpoint and show the wrong UI state (error vs not-found).

Suggested Change:

export const ResourceDetailPage = () => {
  const { id } = useParams<{ id: string }>();
  const resourceId = id?.trim();

  // If your hook supports options, prefer enabling only when id is present.
  const { data: resource, isLoading, isError } = useResourceById(resourceId ?? "", {
    enabled: Boolean(resourceId),
  });

  // If no id, render not-found directly.
  if (!resourceId) {
    return (
      <ErrorState
        variant="info"
        title="Resource not found"
        message="The resource you're looking for doesn't exist or has been removed."
      />
    );
  }

  // ...rest unchanged
};

Comment on lines +1 to +26
import { render, screen } from "@testing-library/react";
import userEvent from "@testing-library/user-event";
import { beforeEach, describe, expect, it, vi } from "vitest";
import { MemoryRouter } from "react-router-dom";

import { ResourceCard } from "./ResourceCard";

const navigate = vi.fn();

vi.mock("react-router-dom", async () => {
const actual =
await vi.importActual<typeof import("react-router-dom")>(
"react-router-dom",
);

return {
...actual,
useNavigate: () => navigate,
};
});

beforeEach(() => {
navigate.mockClear();
});

type RenderOptions = {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Severity: 🔴 Critical
Import React types (or avoid the React. namespace) so tests compile, and assert the expected navigation target.

Suggested Change:

import type { ComponentProps } from "react";

type RenderOptions = {
  additionalProps?: Partial<ComponentProps<typeof ResourceCard>>;
};

const defaultProps: ComponentProps<typeof ResourceCard> = {
  resource: {
    id: "123",
    // ...
  },
};

// ...
	expect(navigate).toHaveBeenCalledWith("/resource/123");

Comment on lines +1 to +3
import { render, screen } from "@testing-library/react";
import userEvent from "@testing-library/user-event";
import { describe, it } from "vitest";

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Severity: 🔴 Critical
Add the missing expect import from vitest to prevent test runtime/compile failures.

Suggested Change:

import { describe, expect, it } from "vitest";

};

return (
<Card

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Severity: 🟠 Major
Make the clickable card keyboard-accessible (or render it as a semantic link/button) so non-mouse users can open resource details.

Suggested Change:

const handleCardKeyDown: React.KeyboardEventHandler = (event) => {
  if (event.key === "Enter" || event.key === " ") {
    event.preventDefault();
    handleCardClick();
  }
};

<Card
  hover
  onClick={handleCardClick}
  onKeyDown={handleCardKeyDown}
  role="button"
  tabIndex={0}
  aria-label={`View details for ${resource.title}`}
>
  {/* ... */}
</Card>

If Card supports rendering asChild, consider wrapping the content in a Link instead for native semantics.


it("should render the search bar input", () => {
renderResourceListPage();
it("should render filter dropdowns", async () => {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Severity: 🟠 Major
Add a regression test that selecting filter options calls the API with mapped enum values (e.g., Articlearticle).

Why this matters: The UI uses label→enum mapping; without a test, a label typo or map change can silently break filtering.

Suggested Change:

it("should call API with mapped filters when user selects options", async () => {
  mockFetchResourcesByFilters.mockResolvedValue([]);
  const { user } = renderResourceListPage();

  await user.click(screen.getByRole("button", { name: /resource type/i }));
  await user.click(screen.getByRole("checkbox", { name: /article/i }));

  await user.click(screen.getByRole("button", { name: /skill levels/i }));
  await user.click(screen.getByRole("checkbox", { name: /beginner/i }));

  await waitFor(() => {
    expect(mockFetchResourcesByFilters).toHaveBeenCalledWith(
      expect.objectContaining({
        types: ["article"],
        levels: ["beginner"],
      }),
    );
  });
});

Comment on lines +74 to +75
it("should render resource title", async () => {
mockFetchResourceById.mockResolvedValue({

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Severity: 💬 Minor [nitpick]
Extract a shared resource fixture to avoid repeating the same object in multiple tests.

Suggested Change:

const buildResource = (overrides: Partial<Resource> = {}): Resource => ({
  id: "1",
  title: "React Basics",
  description: "Learn the basics of React",
  type: "article",
  level: "beginner",
  tags: ["react", "frontend"],
  url: "https://example.com",
  created_at: "2024-01-01T00:00:00Z",
  updated_at: "2024-01-01T00:00:00Z",
  ...overrides,
});

mockFetchResourceById.mockResolvedValue(buildResource());

@mergemitra

mergemitra Bot commented Jan 20, 2026

Copy link
Copy Markdown

PR Overview

PR Type: Feature

Focus Areas for Architect Review

Confirm the intended URL convention for resource detail (/resource/:id vs /resources/:id) and ensure navigation, router config, and tests consistently reflect the chosen pattern.

Validate the boundary strategy for React Query hooks when required params are missing (e.g., disable queries via enabled) to avoid accidental invalid API calls.

Decide whether clickable cards should be implemented as semantic Link/button elements (vs div with onClick) to meet baseline accessibility and keyboard interaction expectations.

PR Insights

Potential PR Improvements

  • Correctness: Keep route paths consistent across app and tests.
  • Robustness: Validate missing IDs before running detail queries.
  • Best Practices: Avoid string-key maps by using typed option values.
  • Testing: Add tests for filter selection and mapping conversions.
  • Code Maintainability: Reduce repeated test fixtures using shared factories.

Strengths

  • Testing: Tests cover loading, error, and empty states.
  • Robustness: UI handles error and not-found states clearly.
  • Code Maintainability: Resource list logic is split into focused components.
  • Best Practices: TanStack Query is configured for predictable test behavior.
  • Code Maintainability: Renamed handlers and variables improve readability.

@mergemitra

mergemitra Bot commented Jan 20, 2026

Copy link
Copy Markdown

Tip

Need another review?

Tag me and say rereview for re-analysis after you have fixed all the issues.

@cw-pr-agent rereview

@LikithaYadavG

Copy link
Copy Markdown
Collaborator Author

@cw-pr-agent rereview

@mergemitra

mergemitra Bot commented Jan 20, 2026

Copy link
Copy Markdown

PR Scorecard

Score

Communication Quality Code Correctness & Design Quality Test Quality & Coverage Code Readability & Maintainability
Scoring Methodology

Communication Scoring Framework

The overall communication score is a weighted average:

Dimension Weight Evaluates
PR Description Quality 60% Title format (conventional commits) + Description clarity (what changed & why)
PR Size & Scope 25% Appropriate sizing, scope cohesion, and justification for size
Commit Messages 15% Conventional commits format, atomic & descriptive changes

Formula: (Description x 0.6) + (PR Size x 0.25) + (Commits x 0.15)

Code Scoring Framework

The scorecard evaluates code using 3 key reviewer questions:

Reviewer Question Category
Is this the right solution, implemented the right way? Code Correctness
Would this catch bugs if the code broke tomorrow? Test Quality
Can someone new understand and safely modify this in 6 months? Maintainability
PR Communication Notes

Description Quality

  • ✅ Description follows the PR template and includes clear manual testing steps.
  • ❌ PR description unchanged; it still omits mention of added unit tests (ResourceListPage.test, ResourceDetailPage.test, ResourceCard.test).
  • ❌ Title still begins with a leading space and is slightly long; remove leading whitespace and keep title ≤72 chars.

PR Size & Scope

  • ✅ This update adds 27 lines across 4 files focused on routing path updates and navigation test improvements.
  • ❌ Tests now use '/resource/:id' in this delta; confirm runtime routes and component links also use the same path to avoid mismatch.

Commit Messages

  • ✅ New commit 'feat(resource-list): update routing paths and enhance test cases for resource navigation' follows conventional commit format.

Notes

Code Correctness & Design Quality

  • 🟠 (UNRESOLVED) Unvalidated label→enum lookups at src/constants/resources.ts:19, src/features/resource-list-page/ResourceListPage.tsx:34 may send undefined filters to API.
  • 🟠 (UNRESOLVED) Passing empty id into detail query at src/features/resource-list-page/ResourceDetailPage.tsx:13 can trigger invalid fetches and wrong error/not-found UI.
  • 🟠 (UNRESOLVED) Resource card click target lacks keyboard semantics at src/features/resource-list-page/components/ResourceCard.tsx:19 blocking non-mouse navigation and a11y tooling.

Test Quality & Coverage

  • 🟠 (UNRESOLVED) Missing regression test for filter label→enum mapping at src/features/resource-list-page/ResourceListPage.test.tsx:69 could let filtering break silently.

Code Readability & Maintainability

  • 🟠 Record<string, ...> annotations at src/constants/resources.ts:19, src/constants/resources.ts:26 erase literal key unions, making refactors and type guards harder.
  • 💬 Minor [nitpick] The global beforeEach at src/features/resource-list-page/components/ResourceList.test.tsx:22 is clearer scoped inside describe, reducing test setup surprises.

];
] as const;

export const RESOURCE_TYPE_MAP: Record<string, ResourceType> = {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Severity: 🟠 Major
Tighten the maps with satisfies + label type guards so unknown UI labels can’t become undefined API filter values.

Why this matters: Record<string, ...> makes MAP[label] look safe in TS even though unknown labels return undefined at runtime.

Suggested Change:

export const RESOURCE_TYPE_MAP = {
  Article: "article",
  Video: "video",
  Documentation: "docs",
  GitHub: "github",
} as const satisfies Record<string, ResourceType>;

export const SKILL_LEVEL_MAP = {
  Beginner: "beginner",
  Intermediate: "intermediate",
  Expert: "expert",
} as const satisfies Record<string, SkillLevel>;

export type ResourceTypeLabel = keyof typeof RESOURCE_TYPE_MAP;
export type SkillLevelLabel = keyof typeof SKILL_LEVEL_MAP;

export const isResourceTypeLabel = (label: string): label is ResourceTypeLabel =>
  label in RESOURCE_TYPE_MAP;
export const isSkillLevelLabel = (label: string): label is SkillLevelLabel =>
  label in SKILL_LEVEL_MAP;

// ResourceListPage.tsx (mapping)
// selectedTypes.filter(isResourceTypeLabel).map((l) => RESOURCE_TYPE_MAP[l])


it("should render the search bar input", () => {
renderResourceListPage();
it("should render filter dropdowns", async () => {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Severity: 🟠 Major
Add a regression test asserting the API is called with mapped enum values when users select UI filter labels.

Why this matters: A label typo or mapping change can silently break filtering without a focused test.

Suggested Change:

it("should call API with mapped filters when user selects options", async () => {
  mockFetchResourcesByFilters.mockResolvedValue([]);
  const { user } = renderResourceListPage();

  await user.click(screen.getByRole("button", { name: /resource type/i }));
  await user.click(screen.getByRole("checkbox", { name: /article/i }));

  await user.click(screen.getByRole("button", { name: /skill levels/i }));
  await user.click(screen.getByRole("checkbox", { name: /beginner/i }));

  await waitFor(() => {
    expect(mockFetchResourcesByFilters).toHaveBeenCalledWith(
      expect.objectContaining({
        types: ["article"],
        levels: ["beginner"],
      }),
    );
  });
});

Comment on lines +10 to +13
export const ResourceDetailPage = () => {
const { id } = useParams<{ id: string }>();
const navigate = useNavigate();
const { data: resource, isLoading, isError } = useResourceById(id ?? "");

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Severity: 🟠 Major
Guard the detail query so useResourceById is not triggered with an empty/missing route param.

Why this matters: Fetching with "" can hit an invalid endpoint and show the wrong UI state (error vs not-found).

Suggested Change:

const { id } = useParams<{ id: string }>();
const resourceId = id?.trim();

if (!resourceId) {
  return (
    <ErrorState
      variant="info"
      title="Resource not found"
      message="The resource you're looking for doesn't exist or has been removed."
    />
  );
}

const { data: resource, isLoading, isError } = useResourceById(resourceId);

};

return (
<Card

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Severity: 🟠 Major
Make the clickable card keyboard-accessible (or render it as a semantic Link) so non-mouse users can open resource details.

Suggested Change:

const handleCardKeyDown: React.KeyboardEventHandler = (event) => {
  if (event.key === "Enter" || event.key === " ") {
    event.preventDefault();
    handleCardClick();
  }
};

<Card
  hover
  onClick={handleCardClick}
  onKeyDown={handleCardKeyDown}
  role="button"
  tabIndex={0}
  aria-label={`View details for ${resource.title}`}
>
  {/* ... */}
</Card>

If possible, prefer a Link for native semantics: to={\/resource/${resource.id}`}`.

};
});

beforeEach(() => {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Severity: 💬 Minor [nitpick]
Move the beforeEach into the describe block to keep test setup scoped and easier to reason about.

Suggested Change:

describe("ResourceList", () => {
  beforeEach(() => {
    navigate.mockClear();
  });

  // tests...
});

@mergemitra

mergemitra Bot commented Jan 20, 2026

Copy link
Copy Markdown

Re-review checklist

  • Verified previously flagged route mismatches are now consistent in updated tests.
  • Checked that previously failing tests compile (missing imports / expect usage).
  • Re-validated remaining previously flagged runtime-safety issues (mapping, missing id guard, a11y) for resolution status.
  • Looked for any new issues introduced by the updated mocks/assertions.

PR Overview

PR Type: Feature

Focus Areas for Architect Review

Confirm label→enum mapping is runtime-safe (type guards + satisfies) and add a regression test so filter behavior can’t silently drift with copy changes.

Decide the canonical boundary behavior for /resource/:id when id is missing/blank, and ensure React Query hooks are disabled/guarded accordingly.

Align clickable card semantics with accessibility expectations (prefer Link/button or add keyboard handlers) to avoid blocking keyboard-only users.

Validation

Route path consistency and navigation target assertions appear resolved in this diff; remaining concerns are map safety + mapping test coverage, missing-id query guarding, and card accessibility semantics.

PR Insights

Potential PR Improvements

  • Correctness: Guard against unknown filter labels before building API params.
  • Testing: Add tests for label-to-enum mapping conversions.
  • Robustness: Ensure mocked router behavior stays isolated across tests.
  • Description Quality: Mention new route convention and added tests.

Strengths

  • Testing: Navigation tests now verify the exact destination path.
  • Best Practices: Tests mock navigation to avoid full router setup.
  • Code Maintainability: Constants use as const for safer refactors.
Rereview Impressions

Progress Since Last Review

  • Routing tests and navigation expectations now use the same /resource/:id pattern.
  • Unit tests now assert the exact navigation target, reducing false positives.
  • Test setup was improved with proper imports, mocks, and reset logic.

New issues introduced (if any)

  • No new issues spotted in the updated diffs.

@LikithaYadavG
LikithaYadavG force-pushed the feat/resource-list-api-integration branch from ca4c347 to b062778 Compare January 20, 2026 09:56
@LikithaYadavG
LikithaYadavG force-pushed the feat/resource-list-api-integration branch from b062778 to c6258a0 Compare January 20, 2026 10:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant