mirror of
https://github.com/discourse/discourse.git
synced 2025-03-20 07:35:31 +08:00
DEV: Add failing test for pull-hotlinked codeblocks (#23682)
If a codeblock contains **exactly** the same markdown as an image which has been retrieved by the 'pull hotlinked' job, then it will be replaced with the new URL. This commit adds failing (skipped) tests for this issue.
This commit is contained in:
parent
408579e6b2
commit
48e3d5b409
@ -183,6 +183,23 @@ RSpec.describe Jobs::PullHotlinkedImages do
|
||||
expect(post.reload.raw).to eq("[Images](#{url})\n")
|
||||
end
|
||||
|
||||
it "does not replace images in code blocks", skip: "Known issue" do
|
||||
post = Fabricate(:post, raw: <<~RAW)
|
||||

|
||||
``
|
||||
RAW
|
||||
stub_image_size
|
||||
|
||||
expect do Jobs::PullHotlinkedImages.new.execute(post_id: post.id) end.to change {
|
||||
Upload.count
|
||||
}.by(1)
|
||||
|
||||
expect(post.reload.raw).to eq(<<~RAW)
|
||||

|
||||
``
|
||||
RAW
|
||||
end
|
||||
|
||||
it "replaces images without protocol" do
|
||||
url = image_url.sub(/^https?\:/, "")
|
||||
post = Fabricate(:post, raw: "<img alt='test' src='#{url}'>")
|
||||
|
@ -385,6 +385,18 @@ RSpec.describe InlineUploads do
|
||||
MD
|
||||
end
|
||||
|
||||
it "should not replace identical markdown in code blocks", skip: "Known issue" do
|
||||
md = <<~MD
|
||||
``
|
||||

|
||||
MD
|
||||
|
||||
expect(InlineUploads.process(md)).to eq(<<~MD)
|
||||
``
|
||||

|
||||
MD
|
||||
end
|
||||
|
||||
it "should not be affected by an emoji" do
|
||||
CustomEmoji.create!(name: "test", upload: upload3)
|
||||
Emoji.clear_cache
|
||||
|
Loading…
x
Reference in New Issue
Block a user