Allow dashes in domain name search
[akkoma] / test / pleroma / user / user_search_test.exs
1 defmodule Pleroma.User.SearchTest do
2 use Pleroma.DataCase
3
4 describe "sanitise_domain/1" do
5 test "should remove url-reserved characters" do
6 examples = [
7 ["example.com", "example.com"],
8 ["no spaces", "nospaces"],
9 ["no@at", "noat"],
10 ["dash-is-ok", "dash-is-ok"],
11 ["underscore_not_so_much", "underscorenotsomuch"],
12 ["no!", "no"],
13 ["no?", "no"],
14 ["a$b%s^o*l(u)t'e#l<y n>o/t", "absolutelynot"]
15 ]
16
17 for [input, expected] <- examples do
18 assert Pleroma.User.Search.sanitise_domain(input) == expected
19 end
20 end
21 end
22 end