- Introduced a new template for listing scenarios associated with a project. - Added metrics for total, active, draft, and archived scenarios. - Implemented quick actions for creating new scenarios and reviewing project overview. - Enhanced navigation with breadcrumbs for better user experience. refactor: update Opex and Profitability templates for consistency - Changed titles and button labels for clarity in Opex and Profitability templates. - Updated form IDs and action URLs for better alignment with new naming conventions. - Improved navigation links to include scenario and project overviews. test: add integration tests for Opex calculations - Created new tests for Opex calculation HTML and JSON flows. - Validated successful calculations and ensured correct data persistence. - Implemented tests for currency mismatch and unsupported frequency scenarios. test: enhance project and scenario route tests - Added tests to verify scenario list rendering and calculator shortcuts. - Ensured scenario detail pages link back to the portfolio correctly. - Validated project detail pages show associated scenarios accurately.
39 lines
1.3 KiB
Python
39 lines
1.3 KiB
Python
from __future__ import annotations
|
|
|
|
from fastapi.testclient import TestClient
|
|
|
|
from models import MiningOperationType
|
|
|
|
|
|
class TestDashboardRoute:
|
|
def test_renders_empty_state(self, client: TestClient) -> None:
|
|
response = client.get("/")
|
|
assert response.status_code == 200
|
|
html = response.text
|
|
|
|
assert "No recent projects" in html
|
|
assert "No simulation runs yet" in html
|
|
assert "All scenarios look good" in html
|
|
assert "—" in html # Last data import placeholder
|
|
|
|
|
|
class TestProjectUIRoutes:
|
|
def test_projects_ui_page_resolves(self, client: TestClient) -> None:
|
|
create_payload = {
|
|
"name": "UI Project",
|
|
"location": "Peru",
|
|
"operation_type": MiningOperationType.OPEN_PIT.value,
|
|
"description": "Project for UI validation",
|
|
}
|
|
client.post("/projects", json=create_payload)
|
|
|
|
response = client.get("/projects/ui")
|
|
assert response.status_code == 200
|
|
assert "Projects" in response.text
|
|
assert "project-card" in response.text
|
|
|
|
def test_projects_create_form_resolves(self, client: TestClient) -> None:
|
|
response = client.get("/projects/create")
|
|
assert response.status_code == 200
|
|
assert "Create Project" in response.text
|