Skip to content

Commit edbaefe

Browse files
authored
BUG: Fix empty person external link IDs (#221)
* BUG: Fix empty person external link IDs * Update to Xcode 16.2
1 parent 5b99bf4 commit edbaefe

18 files changed

+60
-11
lines changed

.github/workflows/ci.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ concurrency:
1717
cancel-in-progress: true
1818

1919
env:
20-
DEVELOPER_DIR: /Applications/Xcode_16.1.app/Contents/Developer
20+
DEVELOPER_DIR: /Applications/Xcode_16.2.app/Contents/Developer
2121

2222
jobs:
2323
build-test:
@@ -68,13 +68,13 @@ jobs:
6868
matrix:
6969
include:
7070
- name: iOS
71-
destination: platform=iOS Simulator,name=iPhone 16,OS=18.0
71+
destination: platform=iOS Simulator,name=iPhone 16,OS=18.2
7272
- name: watchOS
73-
destination: platform=watchOS Simulator,name=Apple Watch Series 10 (46mm),OS=11.0
73+
destination: platform=watchOS Simulator,name=Apple Watch Series 10 (46mm),OS=11.2
7474
- name: tvOS
75-
destination: platform=tvOS Simulator,name=Apple TV 4K (3rd generation),OS=18.0
75+
destination: platform=tvOS Simulator,name=Apple TV 4K (3rd generation),OS=18.2
7676
- name: visionOS
77-
destination: platform=visionOS Simulator,name=Apple Vision Pro,OS=2.0
77+
destination: platform=visionOS Simulator,name=Apple Vision Pro,OS=2.2
7878
steps:
7979
- name: Checkout
8080
uses: actions/checkout@v4

.github/workflows/codeql.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ concurrency:
1717
cancel-in-progress: true
1818

1919
env:
20-
DEVELOPER_DIR: /Applications/Xcode_16.1.app/Contents/Developer
20+
DEVELOPER_DIR: /Applications/Xcode_16.2.app/Contents/Developer
2121

2222
jobs:
2323
analyze:

.github/workflows/documentation.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
build:
2727
name: Build
2828
runs-on: ubuntu-latest
29-
container: swift:6.0-jammy
29+
container: swift:6.0.2-jammy
3030
steps:
3131
- name: Checkout
3232
uses: actions/checkout@v4

.github/workflows/integration.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ concurrency:
2020
cancel-in-progress: true
2121

2222
env:
23-
DEVELOPER_DIR: /Applications/Xcode_16.1.app/Contents/Developer
23+
DEVELOPER_DIR: /Applications/Xcode_16.2.app/Contents/Developer
2424

2525
jobs:
2626
integration-test:

.github/workflows/lint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ concurrency:
1818
cancel-in-progress: true
1919

2020
env:
21-
DEVELOPER_DIR: /Applications/Xcode_16.1.app/Contents/Developer
21+
DEVELOPER_DIR: /Applications/Xcode_16.2.app/Contents/Developer
2222

2323
jobs:
2424
swiftFormat:

Sources/TMDb/Domain/Models/FacebookLink.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ public struct FacebookLink: ExternalLink {
4444
public init?(facebookID: String?) {
4545
guard
4646
let facebookID,
47+
!facebookID.isEmpty,
4748
let url = Self.facebookURL(for: facebookID)
4849
else {
4950
return nil

Sources/TMDb/Domain/Models/IMDbLink.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ public struct IMDbLink: ExternalLink {
6464
public init?(imdbNameID: String?) {
6565
guard
6666
let imdbNameID,
67+
!imdbNameID.isEmpty,
6768
let url = Self.imdbURL(forName: imdbNameID)
6869
else {
6970
return nil

Sources/TMDb/Domain/Models/InstagramLink.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ public struct InstagramLink: ExternalLink {
4444
public init?(instagramID: String?) {
4545
guard
4646
let instagramID,
47+
!instagramID.isEmpty,
4748
let url = Self.instagramURL(for: instagramID)
4849
else {
4950
return nil

Sources/TMDb/Domain/Models/TikTokLink.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ public struct TikTokLink: ExternalLink {
4444
public init?(tikTokID: String?) {
4545
guard
4646
let tikTokID,
47+
!tikTokID.isEmpty,
4748
let url = Self.tikTokURL(for: tikTokID)
4849
else {
4950
return nil

Sources/TMDb/Domain/Models/TwitterLink.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ public struct TwitterLink: ExternalLink {
4444
public init?(twitterID: String?) {
4545
guard
4646
let twitterID,
47+
!twitterID.isEmpty,
4748
let url = Self.twitterURL(for: twitterID)
4849
else {
4950
return nil

Sources/TMDb/Domain/Models/WikiDataLink.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ public struct WikiDataLink: ExternalLink {
4444
public init?(wikiDataID: String?) {
4545
guard
4646
let wikiDataID,
47+
!wikiDataID.isEmpty,
4748
let url = Self.wikiDataURL(for: wikiDataID)
4849
else {
4950
return nil

Sources/TMDb/Domain/Services/People/TMDbPersonService.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,9 @@ final class TMDbPersonService: PersonService {
115115
return personList
116116
}
117117

118-
func externalLinks(forPerson personID: Person.ID) async throws -> PersonExternalLinksCollection
119-
{
118+
func externalLinks(
119+
forPerson personID: Person.ID
120+
) async throws -> PersonExternalLinksCollection {
120121
let request = PersonExternalLinksRequest(id: personID)
121122

122123
let linksCollection: PersonExternalLinksCollection

Tests/TMDbTests/Domain/Models/FacebookLinkTests.swift

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,13 @@ struct FacebookLinkTests {
3232
#expect(facebookLink == nil)
3333
}
3434

35+
@Test("Init with Facebook ID when ID is empty string returns nil")
36+
func initWithFacebookIDWhenIDIsEmptyStringReturnsNil() {
37+
let facebookLink = FacebookLink(facebookID: "")
38+
39+
#expect(facebookLink == nil)
40+
}
41+
3542
@Test("Facebook URL")
3643
func testURL() throws {
3744
let facebookID = "BarbieTheMovie"

Tests/TMDbTests/Domain/Models/IMDbLinkTests.swift

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,13 @@ struct IMDbLinkTests {
3939
#expect(imdbLink == nil)
4040
}
4141

42+
@Test("init with IMDB name ID when ID is empty string returns nil")
43+
func initWithIMDbNameIDWhenIDIsEmptyStringReturnsNil() {
44+
let imdbLink = IMDbLink(imdbNameID: "")
45+
46+
#expect(imdbLink == nil)
47+
}
48+
4249
@Test("URL when using title ID returns show URL")
4350
func urlWhenUsingTitleIDReturnsShowURL() throws {
4451
let imdbID = "tt1517268"

Tests/TMDbTests/Domain/Models/InstagramLinkTests.swift

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,13 @@ struct InstagramLinkTests {
3232
#expect(instagramLink == nil)
3333
}
3434

35+
@Test("init with instagramID when ID is empty string returns nil")
36+
func initWithInstagramIDWhenIDIsEmptyStringReturnsNil() {
37+
let instagramLink = InstagramLink(instagramID: "")
38+
39+
#expect(instagramLink == nil)
40+
}
41+
3542
@Test("URL returns post URL")
3643
func urlReturnsPostURL() throws {
3744
let instagramID = "barbiethemovie"

Tests/TMDbTests/Domain/Models/TikTokLinkTests.swift

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,13 @@ struct TikTokLinkTests {
3232
#expect(tikTokLink == nil)
3333
}
3434

35+
@Test("init with TikTok ID when ID is empty string returns nil")
36+
func initWithTikTokIDWhenIDIsEmptyStringReturnsNil() {
37+
let tikTokLink = TikTokLink(tikTokID: "")
38+
39+
#expect(tikTokLink == nil)
40+
}
41+
3542
@Test("url returns TikTok URL")
3643
func urlReturnsTikTokURL() throws {
3744
let tikTokID = "jasonstatham"

Tests/TMDbTests/Domain/Models/TwitterLinkTests.swift

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,13 @@ struct TwitterLinkTests {
3232
#expect(twitterLint == nil)
3333
}
3434

35+
@Test("init with twitterID when ID is empty string returns nil")
36+
func initWithTwitterIDWhenIDIsEmptyStringReturnsNil() {
37+
let twitterLint = TwitterLink(twitterID: "")
38+
39+
#expect(twitterLint == nil)
40+
}
41+
3542
@Test("url returns Twitter URL")
3643
func urlReturnsTwitterURL() throws {
3744
let twitterID = "barbiethemovie"

Tests/TMDbTests/Domain/Models/WikiDataLinkTests.swift

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,13 @@ struct WikiDataLinkTests {
3232
#expect(wikiDataLink == nil)
3333
}
3434

35+
@Test("init with wikiDataID when ID is empty string returns nil")
36+
func initWithWikiDataIDWhenIDIsEmptyStringReturnsNil() {
37+
let wikiDataLink = WikiDataLink(wikiDataID: "")
38+
39+
#expect(wikiDataLink == nil)
40+
}
41+
3542
@Test("url returns WikiData URL")
3643
func urlReturnsWikiDataURL() throws {
3744
let wikiDataID = "Q55436290"

0 commit comments

Comments
 (0)