Skip to content

Commit

Permalink
Merge pull request #124 from oss-slu/issue-100
Browse files Browse the repository at this point in the history
Implemented deploy as single service changes
  • Loading branch information
bhumulanandinireddy authored Jan 23, 2025
2 parents 382b7d3 + 5af6c8a commit f98468f
Show file tree
Hide file tree
Showing 35 changed files with 743 additions and 504 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@ To start the components individually, please follow the below instructions:
1. To start the client-app: [client-app README.md](client-app/README.md/)
2. To start the server: [server README.md](server/README.md)

To run the application as single service:

1. <code>bash deploy_as_one_service.sh</code>
2. Navigate to the URL that gets provided (http://localhost:5001/)


## Steps to use the application for ORCA log files:

1. For input, you can select any ORCA log file. The test log files are in the esp/test-data/orca-files.
Expand Down
4 changes: 3 additions & 1 deletion client-app/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 5 additions & 6 deletions client-app/src/App.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from "react";
import { BrowserRouter as Router, Route, Routes, Navigate } from "react-router-dom";
import DashboardComponent from "./components/OrcaDashboardComponent";
import TempComponent from "./components/DraftOrcaDashboard";
import { BrowserRouter as Router, Route, Routes } from "react-router-dom";
import DashboardComponent from "./components/OrcaDashboardComponentLegacy";
import OrcaDashboardComponent from "./components/OrcaDashboardComponent";
import GaussianDashboardComponent from "./components/GaussianDashboardComponent";
import NavBarOrca from "./components/NavBar";
import "bootstrap/dist/css/bootstrap.min.css";
Expand All @@ -12,10 +12,9 @@ const App = () => {
<Router>
<NavBarOrca />
<Routes>
<Route path="/orca" element={<DashboardComponent />} />
<Route path="/temp" element={<TempComponent />} />
<Route path="/" element={<OrcaDashboardComponent />} />
<Route path="/temp" element={<DashboardComponent />} />
<Route path="/gaussian" element={<GaussianDashboardComponent />} />
<Route path="/" element={<Navigate to="/orca" replace />} />
<Route path="/about" element={<AboutComponent />} />
</Routes>
</Router>
Expand Down
14 changes: 7 additions & 7 deletions client-app/src/_test_/UploadFile.test.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
import React from "react";
import { render, fireEvent, screen, waitFor } from "@testing-library/react";
import DraftOrcaDashboard from "../components/DraftOrcaDashboard";
import OrcaDashboardComponent from "../components/OrcaDashboardComponent";

// Mock axios to avoid actual API calls
jest.mock("axios", () => ({
post: jest.fn(),
}));

describe("DraftOrcaDashboard", () => {
describe("OrcaDashboardComponent", () => {
beforeEach(() => {
jest.clearAllMocks();
jest.spyOn(window, "alert").mockImplementation(() => {});
jest.spyOn(console, "error").mockImplementation(() => {});
});

test("Clicking on Choose File and uploading an ORCA file", async () => {
render(<DraftOrcaDashboard />);
render(<OrcaDashboardComponent />);

const file = new File(["content"], "test.orca.txt", { type: "text/plain" });
const fileInput = screen.getByLabelText(/Upload ORCA data file/i);
Expand All @@ -32,7 +32,7 @@ describe("DraftOrcaDashboard", () => {
// Assert file upload and display
await waitFor(() => {
expect(mockAxios.post).toHaveBeenCalledWith(
"http://localhost:5001/upload",
"http://127.0.0.1:5001/upload",
expect.any(FormData),
);
});
Expand All @@ -43,7 +43,7 @@ describe("DraftOrcaDashboard", () => {
});

test("Clicking on Choose File and try to upload any file other than the ORCA file", async () => {
render(<DraftOrcaDashboard />);
render(<OrcaDashboardComponent />);

const file = new File(["content"], "test.pdf", { type: "application/pdf" });
const fileInput = screen.getByLabelText(/Upload ORCA data file/i);
Expand All @@ -65,7 +65,7 @@ describe("DraftOrcaDashboard", () => {

/*
test('Clicking on Preview without uploading any file and validating the error message', async () => {
render(<DraftOrcaDashboard />);
render(<OrcaDashboardComponent />);
const previewButton = screen.getByRole('button', { name: /Submit Search Query/i });
Expand All @@ -83,7 +83,7 @@ describe("DraftOrcaDashboard", () => {
const mockAxios = require("axios");
mockAxios.post.mockResolvedValue({}); // Mock the API response

render(<DraftOrcaDashboard />);
render(<OrcaDashboardComponent />);

const downloadButton = screen.getByRole("button", { name: /Download Output/i });

Expand Down
Loading

0 comments on commit f98468f

Please sign in to comment.