mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2026-12-05 19:57:31 +00:00
Convert to Swift testing.
This commit is contained in:
1 parent
dca8aec3c6
commit
69ceb2925d
1 file changed
+12
-14
@@ -6,34 +6,32 @@
|
||||
// Copyright © 2024 Ranchero Software. All rights reserved.
|
||||
//
|
||||
|
||||
import XCTest
|
||||
import Foundation
|
||||
import Testing
|
||||
@testable import FeedFinder
|
||||
import RSParser
|
||||
|
||||
final class FeedFinderTests: XCTestCase {
|
||||
struct FeedFinderTests {
|
||||
|
||||
func testExample() throws {
|
||||
let feedFinder = FeedFinder()
|
||||
XCTAssertNotNil(feedFinder)
|
||||
@Test func knownFeedSpecifierForRelayFMBlog() throws {
|
||||
let url = try #require(URL(string: "https://www.relay.fm/blog"))
|
||||
let specifier = FeedSpecifier.knownFeedSpecifier(url: url)
|
||||
#expect(specifier?.urlString == "https://www.relay.fm/blog/feed")
|
||||
}
|
||||
|
||||
func testKnownFeedSpecifierForRelayFMBlog() throws {
|
||||
let specifier = FeedSpecifier.knownFeedSpecifier(url: URL(string: "https://www.relay.fm/blog")!)
|
||||
XCTAssertEqual(specifier?.urlString, "https://www.relay.fm/blog/feed")
|
||||
@Test func knownFeedSpecifierIgnoresRelayFMRoot() throws {
|
||||
let url = try #require(URL(string: "https://www.relay.fm"))
|
||||
#expect(FeedSpecifier.knownFeedSpecifier(url: url) == nil)
|
||||
}
|
||||
|
||||
func testKnownFeedSpecifierIgnoresRelayFMRoot() throws {
|
||||
XCTAssertNil(FeedSpecifier.knownFeedSpecifier(url: URL(string: "https://www.relay.fm")!))
|
||||
}
|
||||
|
||||
func testBodyLinksWithNonFeedExtensionsAreIgnored() throws {
|
||||
@Test func bodyLinksWithNonFeedExtensionsAreIgnored() {
|
||||
let urlStrings = feedURLStringsInBodyLinks([
|
||||
"https://example.com/feed.xml",
|
||||
"https://example.com/feed.PDF",
|
||||
"https://example.com/feed.pdf?download=1",
|
||||
"https://example.com/rss.jpg#top"
|
||||
])
|
||||
XCTAssertEqual(urlStrings, ["https://example.com/feed.xml"])
|
||||
#expect(urlStrings == ["https://example.com/feed.xml"])
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user