chore: removed unused template page and fixed tests to work after the removal of a duplicate file
This commit is contained in:
@@ -3,7 +3,6 @@
|
|||||||
// © Copyright Utrecht University (Department of Information and Computing Sciences)
|
// © Copyright Utrecht University (Department of Information and Computing Sciences)
|
||||||
import { Routes, Route, Link } from 'react-router'
|
import { Routes, Route, Link } from 'react-router'
|
||||||
import './App.css'
|
import './App.css'
|
||||||
import TemplatePage from './pages/TemplatePage/Template.tsx'
|
|
||||||
import Home from './pages/Home/Home.tsx'
|
import Home from './pages/Home/Home.tsx'
|
||||||
import Robot from './pages/Robot/Robot.tsx';
|
import Robot from './pages/Robot/Robot.tsx';
|
||||||
import ConnectedRobots from './pages/ConnectedRobots/ConnectedRobots.tsx'
|
import ConnectedRobots from './pages/ConnectedRobots/ConnectedRobots.tsx'
|
||||||
@@ -26,7 +25,6 @@ function App(){
|
|||||||
<main className={"flex-col align-center flex-1 scroll-y"}>
|
<main className={"flex-col align-center flex-1 scroll-y"}>
|
||||||
<Routes>
|
<Routes>
|
||||||
<Route path="/" element={<Home />} />
|
<Route path="/" element={<Home />} />
|
||||||
<Route path="/template" element={<TemplatePage />} />
|
|
||||||
<Route path="/editor" element={<VisProg />} />
|
<Route path="/editor" element={<VisProg />} />
|
||||||
<Route path="/robot" element={<Robot />} />
|
<Route path="/robot" element={<Robot />} />
|
||||||
<Route path="/ConnectedRobots" element={<ConnectedRobots />} />
|
<Route path="/ConnectedRobots" element={<ConnectedRobots />} />
|
||||||
|
|||||||
@@ -24,7 +24,6 @@ function Home() {
|
|||||||
<div className={styles.links}>
|
<div className={styles.links}>
|
||||||
<Link to={"/robot"}>Robot Interaction →</Link>
|
<Link to={"/robot"}>Robot Interaction →</Link>
|
||||||
<Link to={"/editor"}>Editor →</Link>
|
<Link to={"/editor"}>Editor →</Link>
|
||||||
<Link to={"/template"}>Template →</Link>
|
|
||||||
<Link to={"/ConnectedRobots"}>Connected Robots →</Link>
|
<Link to={"/ConnectedRobots"}>Connected Robots →</Link>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,14 +0,0 @@
|
|||||||
// This program has been developed by students from the bachelor Computer Science at Utrecht
|
|
||||||
// University within the Software Project course.
|
|
||||||
// © Copyright Utrecht University (Department of Information and Computing Sciences)
|
|
||||||
import Counter from '../../components/components.tsx'
|
|
||||||
|
|
||||||
function TemplatePage() {
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
<Counter />
|
|
||||||
</>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
export default TemplatePage
|
|
||||||
@@ -30,7 +30,7 @@ jest.mock('../../../src/pages/MonitoringPage/MonitoringPageAPI', () => ({
|
|||||||
// Mock VisProg functionality
|
// Mock VisProg functionality
|
||||||
jest.mock('../../../src/pages/VisProgPage/VisProgLogic', () => ({
|
jest.mock('../../../src/pages/VisProgPage/VisProgLogic', () => ({
|
||||||
graphReducer: jest.fn(),
|
graphReducer: jest.fn(),
|
||||||
runProgramm: jest.fn(),
|
runProgram: jest.fn(),
|
||||||
}));
|
}));
|
||||||
|
|
||||||
// Mock Child Components to reduce noise (optional, but keeps unit test focused)
|
// Mock Child Components to reduce noise (optional, but keeps unit test focused)
|
||||||
|
|||||||
@@ -1,83 +0,0 @@
|
|||||||
import { render, screen, fireEvent } from "@testing-library/react";
|
|
||||||
import SimpleProgram from "../../../src/pages/SimpleProgram/SimpleProgram";
|
|
||||||
import useProgramStore from "../../../src/utils/programStore";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Helper to preload the program store before rendering.
|
|
||||||
*/
|
|
||||||
function loadProgram(phases: Record<string, unknown>[]) {
|
|
||||||
useProgramStore.getState().setProgramState({ phases });
|
|
||||||
}
|
|
||||||
|
|
||||||
describe("SimpleProgram", () => {
|
|
||||||
beforeEach(() => {
|
|
||||||
loadProgram([]);
|
|
||||||
});
|
|
||||||
|
|
||||||
test("shows empty state when no program is loaded", () => {
|
|
||||||
render(<SimpleProgram />);
|
|
||||||
expect(screen.getByText("No program loaded.")).toBeInTheDocument();
|
|
||||||
});
|
|
||||||
|
|
||||||
test("renders first phase content", () => {
|
|
||||||
loadProgram([
|
|
||||||
{
|
|
||||||
id: "phase-1",
|
|
||||||
norms: [{ id: "n1", norm: "Be polite" }],
|
|
||||||
goals: [{ id: "g1", description: "Finish task", achieved: true }],
|
|
||||||
triggers: [{ id: "t1", label: "Keyword trigger" }],
|
|
||||||
},
|
|
||||||
]);
|
|
||||||
|
|
||||||
render(<SimpleProgram />);
|
|
||||||
|
|
||||||
expect(screen.getByText("Phase 1 / 1")).toBeInTheDocument();
|
|
||||||
expect(screen.getByText("Be polite")).toBeInTheDocument();
|
|
||||||
expect(screen.getByText("Finish task")).toBeInTheDocument();
|
|
||||||
expect(screen.getByText("Keyword trigger")).toBeInTheDocument();
|
|
||||||
});
|
|
||||||
|
|
||||||
test("allows navigating between phases", () => {
|
|
||||||
loadProgram([
|
|
||||||
{
|
|
||||||
id: "phase-1",
|
|
||||||
norms: [],
|
|
||||||
goals: [],
|
|
||||||
triggers: [],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: "phase-2",
|
|
||||||
norms: [{ id: "n2", norm: "Be careful" }],
|
|
||||||
goals: [],
|
|
||||||
triggers: [],
|
|
||||||
},
|
|
||||||
]);
|
|
||||||
|
|
||||||
render(<SimpleProgram />);
|
|
||||||
|
|
||||||
expect(screen.getByText("Phase 1 / 2")).toBeInTheDocument();
|
|
||||||
|
|
||||||
fireEvent.click(screen.getByText("Next ▶"));
|
|
||||||
|
|
||||||
expect(screen.getByText("Phase 2 / 2")).toBeInTheDocument();
|
|
||||||
expect(screen.getByText("Be careful")).toBeInTheDocument();
|
|
||||||
});
|
|
||||||
|
|
||||||
test("prev button is disabled on first phase", () => {
|
|
||||||
loadProgram([
|
|
||||||
{ id: "phase-1", norms: [], goals: [], triggers: [] },
|
|
||||||
]);
|
|
||||||
|
|
||||||
render(<SimpleProgram />);
|
|
||||||
expect(screen.getByText("◀ Prev")).toBeDisabled();
|
|
||||||
});
|
|
||||||
|
|
||||||
test("next button is disabled on last phase", () => {
|
|
||||||
loadProgram([
|
|
||||||
{ id: "phase-1", norms: [], goals: [], triggers: [] },
|
|
||||||
]);
|
|
||||||
|
|
||||||
render(<SimpleProgram />);
|
|
||||||
expect(screen.getByText("Next ▶")).toBeDisabled();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
Reference in New Issue
Block a user