test showing top clicked links
change
commit f92b83d96c27b997ebdf3f010bc8d15197bd476f
author Alpha Chen <alpha@kejadlen.dev>
date
parent 51b23449
diff --git a/tests/test_go_ji.py b/tests/test_go_ji.py
index 098b435..a08106c 100644
--- a/tests/test_go_ji.py
+++ b/tests/test_go_ji.py
@@ -59,11 +59,27 @@ class TestAuth:
             assert g.user.login == "foo@example"
 
 
-def test_index(authed, client):
-    with authed:
-        response = client.get("/")
+class TestIndex:
+    def test_index(self, authed, client):
+        with authed:
+            response = client.get("/")
+
+            assert response.status_code == 200
 
-        assert response.status_code == 200
+    def test_shows_top_links(self, authed, client):
+        with authed:
+            response = client.get("/")
+            assert b"<td>foo</td>" not in response.data
+
+            client.post("/links", data={"slug": "foo", "url": "https://example.com"})
+            response = client.get("/")
+            assert b"<td>foo</td>" in response.data
+            assert b"0" in response.data
+
+            client.get("/foo", data={"slug": "foo", "url": "https://example.com"})
+            response = client.get("/")
+            assert b"<td>foo</td>" in response.data
+            assert b"1" in response.data
 
 
 class TestCreateLink: