diff --git a/platform/py-monitor/tests/test_core.py b/platform/py-monitor/tests/test_core.py new file mode 100644 index 00000000..1dffd1bc --- /dev/null +++ b/platform/py-monitor/tests/test_core.py @@ -0,0 +1,20 @@ +"""Unit tests for the extracted primitives (stdlib unittest, no deps).""" +import os +import sys +import unittest + +sys.path.insert(0, os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))) + +from monitor_core import (normalize_product_url, normalize_condition, parse_price, + strip_thumbnail_suffix, title_matches_keyword, iso_from_epoch, iso_now) + + +class UrlTests(unittest.TestCase): + + def test_strips_progressive_thumbnail(self): + url = "https://media.example.com/abc.jpg_progressive_thumbnail" + self.assertEqual("https://media.example.com/abc.jpg", strip_thumbnail_suffix(url)) + + +if __name__ == "__main__": + unittest.main()