Skip to content

Commit 94b5739

Browse files
committed
Improved tests
1 parent fdebe49 commit 94b5739

File tree

1 file changed

+21
-11
lines changed

1 file changed

+21
-11
lines changed

Tests/YouTubePlayerSourceTests.swift

+21-11
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,27 @@ import XCTest
44
final class YouTubePlayerSourceTests: XCTestCase {
55

66
func testURLs() throws {
7-
let urls = [
8-
"https://youtube.com/watch?v=psL_5RIBqnY",
9-
"https://youtu.be/psL_5RIBqnY",
10-
"https://youtube.com/embed/psL_5RIBqnY",
11-
"https://youtube.com/c/iJustine",
12-
"https://youtube.com/user/iJustine",
13-
"https://youtube.com/v/0e6HWEy1ZRE"
14-
]
15-
for url in urls {
16-
XCTAssertNotNil(YouTubePlayer.Source.url(url))
17-
}
7+
let testCandidate = UUID().uuidString
8+
XCTAssertEqual(
9+
YouTubePlayer.Source.url("https://youtube.com/watch?v=\(testCandidate)"),
10+
.video(id: testCandidate)
11+
)
12+
XCTAssertEqual(
13+
YouTubePlayer.Source.url("https://youtu.be/\(testCandidate)"),
14+
.video(id: testCandidate)
15+
)
16+
XCTAssertEqual(
17+
YouTubePlayer.Source.url("https://youtube.com/_/\(testCandidate)"),
18+
.video(id: testCandidate)
19+
)
20+
XCTAssertEqual(
21+
YouTubePlayer.Source.url("https://youtube.com/c/\(testCandidate)"),
22+
.channel(name: testCandidate)
23+
)
24+
XCTAssertEqual(
25+
YouTubePlayer.Source.url("https://youtube.com/user/\(testCandidate)"),
26+
.channel(name: testCandidate)
27+
)
1828
}
1929

2030
}

0 commit comments

Comments
 (0)