add stuff

This commit is contained in:
2026-10-21 19:10:45 +02:00
parent 530c2b1ecc
commit 85b0aead6b
3 changed files with 237 additions and 7 deletions
+34
View File
@@ -289,6 +289,40 @@ class StatsPageTest(unittest.TestCase):
self.assertIn("return { name: 'jonassearch_images'", html)
self.assertIn("return { name: 'jonassearch_queue'", html)
def test_page_has_target_eta_field_for_active_tab(self):
client = stats_app.app.test_client()
response = client.get("/")
self.assertEqual(response.status_code, 200)
html = response.get_data(as_text=True)
# a plain number field at the top, plus the computed duration
self.assertIn('id="goal-input"', html)
self.assertIn('type="number" inputmode="numeric"', html)
self.assertIn('id="goal-eta"', html)
self.assertIn('id="goal-hint"', html)
self.assertIn('id="goal-unit"', html)
self.assertIn("Reach target", html)
# the estimate uses the trend of the selected range (last 2 h first)
self.assertIn("function recentTrend(points)", html)
self.assertIn("const reg = recentTrend(fpoints);", html)
self.assertIn("function fmtEta(ms)", html)
self.assertIn("const speed = trend ? trend.slope : null;", html)
self.assertIn("const etaMs = remaining / speed * 3600000;", html)
self.assertIn("if (remaining === 0) {", html)
self.assertIn("Moving away from the target", html)
# one target per tab, restored on tab switch and persisted per browser
self.assertIn("function goalSeries()", html)
self.assertIn("goalTargets[activeMetric] || ''", html)
self.assertIn("localStorage.setItem('js-goal-' + activeMetric, raw)", html)
self.assertIn("localStorage.getItem('js-goal-' + metric)", html)
self.assertIn("toImagePoints(all, showEstimatedImages)", html)
# recomputed on refresh, tab switch and range switch
self.assertIn("renderSummary('summary-queue', pendingAll, pendingFpoints);\n renderGoal();", html)
self.assertIn("goalInput.value = goalTargets[activeMetric] || '';\n renderGoal();", html)
def test_page_contains_pending_queue_counter_and_graphs(self):
client = stats_app.app.test_client()
response = client.get("/")