diff --git a/jest.config.js b/jest.config.js
index a0addb24..1c8fff64 100644
--- a/jest.config.js
+++ b/jest.config.js
@@ -1,4 +1,6 @@
process.env = Object.assign(process.env, {
+ NODE_ENV: "development",
+ REACT_APP_CATI_DASHBOARD_URL: "cati-dashboard-url/Blaise/CaseInfo",
VM_EXTERNAL_CLIENT_URL: "external-client-url",
VM_EXTERNAL_WEB_URL: "external-web-url",
BLAISE_API_URL: "mock",
diff --git a/server/Config.ts b/server/Config.ts
index 531b6ee0..247db845 100644
--- a/server/Config.ts
+++ b/server/Config.ts
@@ -8,12 +8,12 @@ export interface EnvironmentVariables {
}
export function getEnvironmentVariables(): EnvironmentVariables {
- let {VM_EXTERNAL_CLIENT_URL,
- VM_EXTERNAL_WEB_URL,
- BLAISE_API_URL,
- BIMS_CLIENT_ID,
- BIMS_API_URL} = process.env;
- const CATI_DASHBOARD_URL = "https://" + VM_EXTERNAL_WEB_URL + "/Blaise";
+ let { VM_EXTERNAL_CLIENT_URL,
+ VM_EXTERNAL_WEB_URL,
+ BLAISE_API_URL,
+ BIMS_CLIENT_ID,
+ BIMS_API_URL } = process.env;
+ const CATI_DASHBOARD_URL = "https://" + VM_EXTERNAL_WEB_URL + "/Blaise/CaseInfo";
if (BLAISE_API_URL === undefined) {
console.error("BLAISE_API_URL environment variable has not been set");
@@ -40,12 +40,14 @@ export function getEnvironmentVariables(): EnvironmentVariables {
BIMS_API_URL = "ENV_VAR_NOT_SET";
}
- return {VM_EXTERNAL_CLIENT_URL,
- VM_EXTERNAL_WEB_URL,
+ return {
+ VM_EXTERNAL_CLIENT_URL,
+ VM_EXTERNAL_WEB_URL,
BLAISE_API_URL: fixURL(BLAISE_API_URL),
- CATI_DASHBOARD_URL,
- BIMS_CLIENT_ID,
- BIMS_API_URL};
+ CATI_DASHBOARD_URL,
+ BIMS_CLIENT_ID,
+ BIMS_API_URL
+ };
}
function fixURL(url: string): string {
diff --git a/server/index.ts b/server/index.ts
index d8561f71..c0360011 100644
--- a/server/index.ts
+++ b/server/index.ts
@@ -4,7 +4,7 @@ import * as profiler from "@google-cloud/profiler";
import { getEnvironmentVariables } from "./Config";
import dotenv from "dotenv";
-profiler.start({logLevel: 4}).catch((err: unknown) => {
+profiler.start({ logLevel: 4 }).catch((err: unknown) => {
console.log(`Failed to start profiler: ${err}`);
});
@@ -24,4 +24,4 @@ const app = nodeServer(environmentVariables, blaiseApiClient);
app.listen(port);
-console.log("App is listening on port " + port);
+console.log("App is listening on port " + port);
\ No newline at end of file
diff --git a/server/tests/config.test.ts b/server/tests/config.test.ts
index 58cce472..d3da0c8e 100644
--- a/server/tests/config.test.ts
+++ b/server/tests/config.test.ts
@@ -1,4 +1,4 @@
-import {getEnvironmentVariables} from "../Config";
+import { getEnvironmentVariables } from "../Config";
describe("Config setup", () => {
afterEach(() => {
@@ -20,7 +20,7 @@ describe("Config setup", () => {
expect(VM_EXTERNAL_CLIENT_URL).toBe("external-client-url");
expect(VM_EXTERNAL_WEB_URL).toBe("external-web-url");
expect(BLAISE_API_URL).toBe("http://mock");
- expect(CATI_DASHBOARD_URL).toBe("https://external-web-url/Blaise");
+ expect(CATI_DASHBOARD_URL).toBe("https://external-web-url/Blaise/CaseInfo");
expect(BIMS_CLIENT_ID).toBe("mock@id");
expect(BIMS_API_URL).toBe("mock-bims-api");
});
@@ -46,7 +46,7 @@ describe("Config setup", () => {
expect(VM_EXTERNAL_CLIENT_URL).toBe("ENV_VAR_NOT_SET");
expect(VM_EXTERNAL_WEB_URL).toBe("ENV_VAR_NOT_SET");
expect(BLAISE_API_URL).toBe("ENV_VAR_NOT_SET");
- expect(CATI_DASHBOARD_URL).toBe("https://undefined/Blaise");
+ expect(CATI_DASHBOARD_URL).toBe("https://undefined/Blaise/CaseInfo");
expect(BIMS_CLIENT_ID).toBe("ENV_VAR_NOT_SET");
expect(BIMS_API_URL).toBe("ENV_VAR_NOT_SET");
});
diff --git a/src/App.test.tsx b/src/App.test.tsx
index 5e1e92fe..80da2640 100644
--- a/src/App.test.tsx
+++ b/src/App.test.tsx
@@ -1,12 +1,12 @@
import React from "react";
import { render, waitFor, fireEvent, screen, cleanup } from "@testing-library/react";
-import App from "./App";
import "@testing-library/jest-dom";
import flushPromises from "./tests/utils";
import { act } from "react-dom/test-utils";
import { createMemoryHistory } from "history";
import { Router } from "react-router-dom";
import { Survey } from "blaise-api-node-client";
+import App from "./App";
const surveyListReturned: Survey[] = [
{
@@ -103,6 +103,8 @@ describe("React homepage", () => {
await waitFor(() => {
expect(getByText(/Telephone Operations Blaise Interface/i)).toBeDefined();
+ expect(queryByText(/Link to CATI dashboard/i)).toBeInTheDocument();
+ expect(queryByText(/Link to CATI dashboard/i)?.getAttribute("href")).toContain("/Blaise/CaseInfo");
expect(getByText(/OPN/i)).toBeDefined();
expect(queryByText(/Loading/i)).not.toBeInTheDocument();
});
diff --git a/src/App.tsx b/src/App.tsx
index 8ae3bed9..0a988266 100644
--- a/src/App.tsx
+++ b/src/App.tsx
@@ -1,12 +1,12 @@
-import React, {ReactElement, useEffect, useState} from "react";
-import {DefaultErrorBoundary} from "./Components/ErrorHandling/DefaultErrorBoundary";
-import {isDevEnv, isTrainingEnv} from "./Functions";
-import {Switch, Route} from "react-router-dom";
+import React, { ReactElement, useEffect, useState } from "react";
+import { DefaultErrorBoundary } from "./Components/ErrorHandling/DefaultErrorBoundary";
+import { isDevEnv, isTrainingEnv } from "./Functions";
+import { Switch, Route } from "react-router-dom";
import InstrumentList from "./Components/InstrumentList";
import SurveyList from "./Components/SurveyList";
-import {Survey} from "blaise-api-node-client";
-import {ErrorBoundary} from "./Components/ErrorHandling/ErrorBoundary";
-import {Footer, Header, ONSErrorPanel, ExternalLink} from "blaise-design-system-react-components";
+import { Survey } from "blaise-api-node-client";
+import { ErrorBoundary } from "./Components/ErrorHandling/ErrorBoundary";
+import { Footer, Header, ONSErrorPanel, ExternalLink } from "blaise-design-system-react-components";
interface listError {
error: boolean,
@@ -28,10 +28,10 @@ function App(): ReactElement {
useEffect(() => {
if (isTrainingEnv()) setHeaderText("Telephone Operations Blaise Interface (training)");
- });
+ });
const [externalClientUrl, setExternalClientUrl] = useState