allow empty favs list
This commit is contained in:
@@ -151,7 +151,7 @@ class Domain::Fa::Parser::UserPageHelper < Domain::Fa::Parser::Base
|
||||
/\/view\/(\d+)/.match(href)[1]&.to_i || raise(
|
||||
"invalid url: #{href}"
|
||||
)
|
||||
end
|
||||
end || []
|
||||
else unimplemented_version!
|
||||
end
|
||||
end
|
||||
|
||||
@@ -364,6 +364,17 @@ describe Domain::Fa::Parser::Page do
|
||||
assert_equal up.registered_since, DateTime.parse("Sep 7, 2018 06:19")
|
||||
end
|
||||
|
||||
it "handles pages with no favorites" do
|
||||
parser = get_parser("azurathefox_user_page.html")
|
||||
assert_page_type parser, :probably_user_page?
|
||||
up = parser.user_page
|
||||
assert_equal up.name, "AzuraTheFox"
|
||||
assert_equal up.recent_fav_fa_ids, []
|
||||
assert_equal up.recent_watchers.first.to_a, ["SN214549", "sn214549"]
|
||||
assert_equal up.recent_watchers.last.to_a, ["Duckyou7464", "duckyou7464"]
|
||||
assert_equal up.recent_watching, []
|
||||
end
|
||||
|
||||
def get_parser(file, require_logged_in: true)
|
||||
path = File.join("domain/fa/parser/redux", file)
|
||||
contents = SpecUtil.read_fixture_file(path) || raise("Couldn't open #{path}")
|
||||
|
||||
892
test/fixtures/files/domain/fa/parser/redux/azurathefox_user_page.html
vendored
Normal file
892
test/fixtures/files/domain/fa/parser/redux/azurathefox_user_page.html
vendored
Normal file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user