make top links into actual links
change
commit f822613ffbaebb8deff06928a670268746cefc0b
author Alpha Chen <alpha@kejadlen.dev>
date
parent f92b83d9
diff --git a/go_ji/templates/index.html b/go_ji/templates/index.html
index 3c1cde8..d7e8369 100644
--- a/go_ji/templates/index.html
+++ b/go_ji/templates/index.html
@@ -18,7 +18,7 @@
       <tr><th>short</th><th>clicks</th></tr>
       {% for short in top_shorts %}
       <tr>
-        <td>{{ short.slug }}</td>
+        <td><a href="{{ url_for('go', slug=short.slug) }}">{{ short.slug }}</a></td>
         <td>{{ short.clicks }}</td>
       </tr>
       {% endfor %}
diff --git a/tests/test_go_ji.py b/tests/test_go_ji.py
index a08106c..800e016 100644
--- a/tests/test_go_ji.py
+++ b/tests/test_go_ji.py
@@ -69,16 +69,16 @@ class TestIndex:
     def test_shows_top_links(self, authed, client):
         with authed:
             response = client.get("/")
-            assert b"<td>foo</td>" not in response.data
+            assert b"foo</a>" 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"foo</a>" 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"foo</a>" in response.data
             assert b"1" in response.data