from linetoday.frontier import normalize_url def test_normalize_strip_tracking(): url = 'https://today.line.me/th/article/ABC?utm_source=foo&x=1&y=2#section' n = normalize_url(url) assert 'utm_source' not in n assert '#' not in n assert n.startswith('https://') def test_normalize_sort_query(): url = 'https://today.line.me/th?page=2&b=2&a=1' n = normalize_url(url) # query params should be sorted: a then b assert 'a=1' in n and 'b=2' in n