From 57e0afc88613c887b7650122e51de1a50a8eff11 Mon Sep 17 00:00:00 2001 From: hoelee Date: Thu, 15 Oct 2026 11:12:00 +0800 Subject: [PATCH] feat(py-monitor): add test_core.py() --- platform/py-monitor/tests/test_core.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/platform/py-monitor/tests/test_core.py b/platform/py-monitor/tests/test_core.py index 80586919..6d8fb404 100644 --- a/platform/py-monitor/tests/test_core.py +++ b/platform/py-monitor/tests/test_core.py @@ -19,6 +19,19 @@ class UrlTests(unittest.TestCase): url = "https://media.example.com/abc.jpg" self.assertEqual(url, strip_thumbnail_suffix(url)) + def test_strip_keeps_empty_input(self): + self.assertEqual("", strip_thumbnail_suffix("")) + + def test_normalize_drops_query_and_fragment(self): + a = "https://www.carousell.com.my/p/1234/?utm_source=x#top" + b = "https://WWW.Carousell.com.my/p/1234/" + self.assertEqual(normalize_product_url(a), normalize_product_url(b)) + self.assertEqual("https://www.carousell.com.my/p/1234", normalize_product_url(a)) + + def test_normalize_handles_empty(self): + self.assertEqual("", normalize_product_url(None)) + + if __name__ == "__main__": unittest.main()