bmp support, buggy fa user, url decode usernames

This commit is contained in:
Dylan Knutson
2025-08-16 04:44:04 +00:00
parent 1e46e42352
commit a1fab9e645
13 changed files with 1457 additions and 21 deletions

View File

@@ -12,6 +12,39 @@ describe Domain::Fa::Job::UserPageJob do
)
end
context "the user page has a user with a url name that has brackets" do
let(:client_mock_config) do
[
{
uri: "https://www.furaffinity.net/user/thesteamlemur/",
status_code: 200,
content_type: "text/html",
contents:
SpecUtil.read_fixture_file(
"domain/fa/user_page/user_page_thesteamlemur.html",
),
},
]
end
it "creates the user" do
expect do perform_now({ url_name: "thesteamlemur" }) end.to change {
Domain::User::FaUser.find_by(url_name: "thesteamlemur")
}.from(nil).to(be_present)
end
it "creates the recent watchers" do
perform_now({ url_name: "thesteamlemur" })
user = Domain::User::FaUser.find_by(url_name: "thesteamlemur")
expect(user.followed_by_users.count).to eq(7)
expect(user.followed_by_users.map(&:url_name)).to include(
"[sic]",
"drakenbyte",
"naynay",
)
end
end
context "the user is disabled" do
let(:client_mock_config) do
[

View File

@@ -24,6 +24,14 @@ RSpec.describe LoadedMedia do
let(:mp4_fixture_path) do
Rails.root.join("test/fixtures/files/images/bsky-3l6tnjkcgw72y.mp4").to_s
end
let(:bmp_fixture_path) do
Rails
.root
.join(
"test/fixtures/files/images/1404612500.nickthefur775_streaminglive.bmp",
)
.to_s
end
let(:thumbnail_options) do
LoadedMedia::ThumbnailOptions.new(
@@ -192,5 +200,17 @@ RSpec.describe LoadedMedia do
expect(FileUtils.compare_file(paths[1], paths[2])).to be false
end
end
context "with a bmp file" do
it "can extract a frame and save a thumbnail" do
media = LoadedMedia.from_file("image/bmp", bmp_fixture_path)
output_path = make_output_path(0)
media.write_frame_thumbnail(0, output_path, thumbnail_options)
expect(File.exist?(output_path)).to be true
expect(File.size(output_path)).to be > 0
end
end
end
end