,
+}));
+
+describe("SecurityPage", () => {
+ it("shows stats and default tab content", () => {
+ render();
+ expect(screen.getByText("trigger-stat")).toBeInTheDocument();
+ expect(screen.getByText("tab-bar")).toBeInTheDocument();
+ expect(screen.getByText("report-analysis")).toBeInTheDocument();
+ });
+
+ it("applies stat filter mode and supports back action", () => {
+ render();
+ fireEvent.click(screen.getByText("trigger-stat"));
+ expect(screen.getByRole("button", { name: "Back" })).toBeInTheDocument();
+ expect(screen.queryByText("tab-bar")).not.toBeInTheDocument();
+ fireEvent.click(screen.getByRole("button", { name: "Back" }));
+ expect(screen.getByText("tab-bar")).toBeInTheDocument();
+ });
+});
diff --git a/apps/customer-portal/webapp/src/features/security/pages/__tests__/VulnerabilityDetailsPage.test.tsx b/apps/customer-portal/webapp/src/features/security/pages/__tests__/VulnerabilityDetailsPage.test.tsx
new file mode 100644
index 0000000000..5fda06f8dc
--- /dev/null
+++ b/apps/customer-portal/webapp/src/features/security/pages/__tests__/VulnerabilityDetailsPage.test.tsx
@@ -0,0 +1,75 @@
+// Copyright (c) 2026 WSO2 LLC. (https://www.wso2.com).
+//
+// WSO2 LLC. licenses this file to you under the Apache License,
+// Version 2.0 (the "License"); you may not use this file except
+// in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+import { fireEvent, render, screen } from "@testing-library/react";
+import { describe, expect, it, vi, beforeEach } from "vitest";
+import VulnerabilityDetailsPage from "@features/security/pages/VulnerabilityDetailsPage";
+
+const mockNavigate = vi.fn();
+const mockShowLoader = vi.fn();
+const mockHideLoader = vi.fn();
+const mockShowError = vi.fn();
+const mockHook = vi.fn();
+
+vi.mock("react-router", () => ({
+ useNavigate: () => mockNavigate,
+ useParams: () => ({ projectId: "p-1", vulnerabilityId: "v-1" }),
+}));
+
+vi.mock("@context/linear-loader/LoaderContext", () => ({
+ useLoader: () => ({ showLoader: mockShowLoader, hideLoader: mockHideLoader }),
+}));
+
+vi.mock("@context/error-banner/ErrorBannerContext", () => ({
+ useErrorBanner: () => ({ showError: mockShowError }),
+}));
+
+vi.mock("@features/security/api/useGetProductVulnerability", () => ({
+ useGetProductVulnerability: (...args: unknown[]) => mockHook(...args),
+}));
+
+vi.mock("@features/security/components/VulnerabilityDetailsContent", () => ({
+ default: ({ onBack }: { onBack: () => void }) => (
+
+ ),
+}));
+
+describe("VulnerabilityDetailsPage", () => {
+ beforeEach(() => {
+ vi.clearAllMocks();
+ });
+
+ it("shows loader while vulnerability details are loading", () => {
+ mockHook.mockReturnValue({ data: undefined, isLoading: true, isError: false });
+ render();
+ expect(mockShowLoader).toHaveBeenCalled();
+ });
+
+ it("shows error banner when request fails", () => {
+ mockHook.mockReturnValue({ data: undefined, isLoading: false, isError: true });
+ render();
+ expect(mockShowError).toHaveBeenCalled();
+ });
+
+ it("navigates back to security center", () => {
+ mockHook.mockReturnValue({ data: { id: "1" }, isLoading: false, isError: false });
+ render();
+ fireEvent.click(screen.getByText("go-back"));
+ expect(mockNavigate).toHaveBeenCalledWith("/projects/p-1/security-center", {
+ state: { fromBack: true },
+ });
+ });
+});
diff --git a/apps/customer-portal/webapp/src/features/security/utils/__tests__/productVulnerabilitiesTable.test.ts b/apps/customer-portal/webapp/src/features/security/utils/__tests__/productVulnerabilitiesTable.test.ts
new file mode 100644
index 0000000000..30e174904d
--- /dev/null
+++ b/apps/customer-portal/webapp/src/features/security/utils/__tests__/productVulnerabilitiesTable.test.ts
@@ -0,0 +1,40 @@
+// Copyright (c) 2026 WSO2 LLC. (https://www.wso2.com).
+//
+// WSO2 LLC. licenses this file to you under the Apache License,
+// Version 2.0 (the "License"); you may not use this file except
+// in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+import { describe, expect, it } from "vitest";
+import {
+ countProductVulnerabilityTableActiveFilters,
+ formatProductVulnerabilitiesClearFiltersLabel,
+} from "@features/security/utils/productVulnerabilitiesTable";
+
+describe("productVulnerabilitiesTable utils", () => {
+ it("counts active filters and trimmed search input", () => {
+ expect(
+ countProductVulnerabilityTableActiveFilters(" CVE ", {
+ severityId: 1,
+ productName: "APIM",
+ productVersion: "4.2.0",
+ }),
+ ).toBe(4);
+ expect(countProductVulnerabilityTableActiveFilters(" ", {})).toBe(0);
+ });
+
+ it("formats clear-filter label with count", () => {
+ expect(formatProductVulnerabilitiesClearFiltersLabel(3)).toBe(
+ "Clear Filters (3)",
+ );
+ });
+});
diff --git a/apps/customer-portal/webapp/src/features/security/utils/__tests__/securityPage.test.ts b/apps/customer-portal/webapp/src/features/security/utils/__tests__/securityPage.test.ts
new file mode 100644
index 0000000000..7e2b6c0bff
--- /dev/null
+++ b/apps/customer-portal/webapp/src/features/security/utils/__tests__/securityPage.test.ts
@@ -0,0 +1,54 @@
+// Copyright (c) 2026 WSO2 LLC. (https://www.wso2.com).
+//
+// WSO2 LLC. licenses this file to you under the Apache License,
+// Version 2.0 (the "License"); you may not use this file except
+// in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+import { describe, expect, it } from "vitest";
+import {
+ parseSecurityTabQueryParam,
+ parseSecurityReportCaseSortField,
+ parseSecurityReportViewMode,
+} from "@features/security/utils/securityPage";
+import {
+ SecurityReportCaseSortField,
+ SecurityReportViewMode,
+ SecurityTabId,
+} from "@features/security/types/security";
+
+describe("securityPage utils", () => {
+ it("parses tab query param with fallback", () => {
+ expect(parseSecurityTabQueryParam(SecurityTabId.COMPONENTS)).toBe(
+ SecurityTabId.COMPONENTS,
+ );
+ expect(parseSecurityTabQueryParam("invalid")).toBe(
+ SecurityTabId.VULNERABILITIES,
+ );
+ });
+
+ it("parses report view mode with fallback to all", () => {
+ expect(parseSecurityReportViewMode(SecurityReportViewMode.MY)).toBe(
+ SecurityReportViewMode.MY,
+ );
+ expect(parseSecurityReportViewMode("unknown")).toBe(SecurityReportViewMode.ALL);
+ });
+
+ it("parses case sort field with fallback to createdOn", () => {
+ expect(parseSecurityReportCaseSortField(SecurityReportCaseSortField.state)).toBe(
+ SecurityReportCaseSortField.state,
+ );
+ expect(parseSecurityReportCaseSortField("bad")).toBe(
+ SecurityReportCaseSortField.createdOn,
+ );
+ });
+});
diff --git a/apps/customer-portal/webapp/src/features/security/utils/__tests__/vulnerabilities.test.ts b/apps/customer-portal/webapp/src/features/security/utils/__tests__/vulnerabilities.test.ts
new file mode 100644
index 0000000000..1140ab3864
--- /dev/null
+++ b/apps/customer-portal/webapp/src/features/security/utils/__tests__/vulnerabilities.test.ts
@@ -0,0 +1,35 @@
+// Copyright (c) 2026 WSO2 LLC. (https://www.wso2.com).
+//
+// WSO2 LLC. licenses this file to you under the Apache License,
+// Version 2.0 (the "License"); you may not use this file except
+// in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+import { describe, expect, it } from "vitest";
+import {
+ getVulnerabilitySeverityColor,
+ getVulnerabilityStatusColor,
+} from "@features/security/utils/vulnerabilities";
+
+describe("vulnerabilities utils", () => {
+ it("maps severity labels to theme colors", () => {
+ expect(getVulnerabilitySeverityColor(" Critical ")).toBe("error.main");
+ expect(getVulnerabilitySeverityColor("HIGH")).toBe("warning.main");
+ expect(getVulnerabilitySeverityColor("unknown")).toBe("text.secondary");
+ });
+
+ it("maps status labels to theme colors with strict matching", () => {
+ expect(getVulnerabilityStatusColor("in progress")).toBe("warning.main");
+ expect(getVulnerabilityStatusColor("resolved")).toBe("success.main");
+ expect(getVulnerabilityStatusColor("unresolved")).toBe("text.secondary");
+ });
+});