This commit is contained in:
Arkadiusz Fal
2022-06-30 01:31:51 +02:00
parent 25ef0a4383
commit f8fe2961ca
6 changed files with 68 additions and 3 deletions

View File

@@ -16,6 +16,11 @@ final class URLParserTests: XCTestCase {
"c/ABCDE": "ABCDE"
]
private static let users: [String: String] = [
"https://m.youtube.com/user/ARD": "ARD",
"m.youtube.com/user/ARD": "ARD"
]
private static let channelsByID: [String: String] = [
"https://piped.kavin.rocks/channel/UCbcxFkd6B9xUU54InHv4Tig": "UCbcxFkd6B9xUU54InHv4Tig",
"youtube.com/channel/UCbcxFkd6B9xUU54InHv4Tig": "UCbcxFkd6B9xUU54InHv4Tig",
@@ -68,6 +73,16 @@ final class URLParserTests: XCTestCase {
}
}
func testUsersParsing() throws {
Self.users.forEach { url, user in
let parser = URLParser(url: URL(string: url)!)
XCTAssertEqual(parser.destination, .channel)
XCTAssertNil(parser.channelID)
XCTAssertNil(parser.channelName)
XCTAssertEqual(parser.username, user)
}
}
func testPlaylistsParsing() throws {
Self.playlists.forEach { url, id in
let parser = URLParser(url: URL(string: url)!)