diff --git a/tests/test_domains.py b/tests/test_domains.py new file mode 100644 index 00000000..a6e0680a --- /dev/null +++ b/tests/test_domains.py @@ -0,0 +1,19 @@ +import pytest + +from scraper.domains import get_website_name + +test_websites = [ + ("https://www.amazon.com/", "amazon"), + ("https://www.komplett.dk/", "komplett"), + ("https://www.av-cables.dk/", "av-cables"), + ("https://nowww.com/", "nowww"), + ("https://no-ending-slash.com", "no-ending-slash"), + ("https://www.test.testing.com/", "test.testing"), + ("https://www.test.hello.com/hello/world", "test.hello"), +] + + +@pytest.mark.parametrize("url,expected", test_websites) +def test_get_website_name(url, expected): + result = get_website_name(url) + assert result == expected