Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions apps/web/src/app.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,8 @@ describe("Web Application", () => {

it("should register public pages routes", async () => {
const { createSimpleRouter } = await import("@hmcts/simple-router");
// Should be called 8 times: location API routes, civil-family-cause-list pages, web pages, auth routes, public pages, verified pages, system-admin pages, admin routes
expect(createSimpleRouter).toHaveBeenCalledTimes(8);
// Should be called 9 times: location API routes, civil-family-cause-list pages, care-standards-tribunal pages, web pages, auth routes, public pages, verified pages, system-admin pages, admin routes
expect(createSimpleRouter).toHaveBeenCalledTimes(9);
});

it("should register system-admin page routes", async () => {
Expand Down
8 changes: 7 additions & 1 deletion apps/web/src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ import "@hmcts/web-core"; // Import for Express type augmentation
import { fileUploadRoutes as adminFileUploadRoutes, moduleRoot as adminModuleRoot, pageRoutes as adminRoutes } from "@hmcts/admin-pages/config";
import { authNavigationMiddleware, cftCallbackHandler, configurePassport, ssoCallbackHandler } from "@hmcts/auth";
import { moduleRoot as authModuleRoot, pageRoutes as authRoutes } from "@hmcts/auth/config";
import {
moduleRoot as careStandardsTribunalModuleRoot,
pageRoutes as careStandardsTribunalRoutes
} from "@hmcts/care-standards-tribunal-weekly-hearing-list/config";
import { moduleRoot as civilFamilyCauseListModuleRoot, pageRoutes as civilFamilyCauseListRoutes } from "@hmcts/civil-and-family-daily-cause-list/config";
import { configurePropertiesVolume, healthcheck, monitoringMiddleware } from "@hmcts/cloud-native-platform";
import { moduleRoot as listTypesCommonModuleRoot } from "@hmcts/list-types-common/config";
Expand Down Expand Up @@ -69,6 +73,7 @@ export async function createApp(): Promise<Express> {
adminModuleRoot,
authModuleRoot,
listTypesCommonModuleRoot,
careStandardsTribunalModuleRoot,
civilFamilyCauseListModuleRoot,
systemAdminModuleRoot,
publicPagesModuleRoot,
Expand Down Expand Up @@ -106,8 +111,9 @@ export async function createApp(): Promise<Express> {
// Register API routes for location autocomplete
app.use(await createSimpleRouter(locationApiRoutes));

// Register civil-and-family-daily-cause-list routes first to ensure proper route matching
// Register list type routes first to ensure proper route matching
app.use(await createSimpleRouter(civilFamilyCauseListRoutes));
app.use(await createSimpleRouter(careStandardsTribunalRoutes));

app.use(await createSimpleRouter({ path: `${__dirname}/pages` }, pageRoutes));
app.use(await createSimpleRouter(authRoutes, pageRoutes));
Expand Down
4 changes: 4 additions & 0 deletions apps/web/src/assets/js/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ vi.mock("@hmcts/web-core/src/assets/js/search-autocomplete.js", () => ({
initSearchAutocomplete: vi.fn(() => Promise.resolve())
}));

vi.mock("@hmcts/web-core/src/assets/js/search-highlight.js", () => ({
initSearchHighlight: vi.fn()
}));

vi.mock("govuk-frontend", () => ({
initAll: vi.fn()
}));
Expand Down
3 changes: 3 additions & 0 deletions apps/web/src/assets/js/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import cookieManager from "@hmcts/cookie-manager";
import { initBackToTop } from "@hmcts/web-core/src/assets/js/back-to-top.js";
import { initFilterPanel } from "@hmcts/web-core/src/assets/js/filter-panel.js";
import { initSearchAutocomplete } from "@hmcts/web-core/src/assets/js/search-autocomplete.js";
import { initSearchHighlight } from "@hmcts/web-core/src/assets/js/search-highlight.js";
import { initAll } from "govuk-frontend";

initAll();
Expand All @@ -14,13 +15,15 @@ if (document.readyState === "loading") {
});
initFilterPanel();
initBackToTop();
initSearchHighlight();
});
} else {
void initSearchAutocomplete().catch((error) => {
console.error("Error initializing search autocomplete:", error);
});
initFilterPanel();
initBackToTop();
initSearchHighlight();
}

const config = {
Expand Down
Loading