line-today-scrape/tests/test_frontier.py
Sosokker 0b5b9d98c5
Some checks are pending
CI / test (push) Waiting to run
add main files
2025-10-29 16:12:55 +07:00

17 lines
481 B
Python

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