// // HTMLImageAttributeInserterTests.swift // RSParserTests // // Created by Brent Simmons on 10/27/26. // import Foundation import Testing import RSParser @Suite struct HTMLImageAttributeInserterTests { @Test func attributesAreInsertedIntoImagesWhoseSourceResolvesToURL() { let html = """
Café

\


"""
let result = HTMLImageAttributeInserter.insertingAttributes(" src=\"nnw:x\"", intoImagesWithSource: "https://example.com/images/photo.jpg", html: html, baseURL: "https://example.com/2026/10/post.html")
let expected = """
Café


"""
#expect(result == expected)
}
@Test func imagesWrittenAsTextInTextareaAreLeftAlone() {
let html = #"
"#
let result = HTMLImageAttributeInserter.insertingAttributes(" src=\"nnw:x\"", intoImagesWithSource: "https://example.com/images/photo.jpg", html: html, baseURL: "https://example.com/")
#expect(result == #"