Skip to content

Commit

Permalink
BUG: Fix empty person external link IDs (#221)
Browse files Browse the repository at this point in the history
* BUG: Fix empty person external link IDs

* Update to Xcode 16.2
  • Loading branch information
adamayoung authored Jan 2, 2025
1 parent 5b99bf4 commit edbaefe
Show file tree
Hide file tree
Showing 18 changed files with 60 additions and 11 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ concurrency:
cancel-in-progress: true

env:
DEVELOPER_DIR: /Applications/Xcode_16.1.app/Contents/Developer
DEVELOPER_DIR: /Applications/Xcode_16.2.app/Contents/Developer

jobs:
build-test:
Expand Down Expand Up @@ -68,13 +68,13 @@ jobs:
matrix:
include:
- name: iOS
destination: platform=iOS Simulator,name=iPhone 16,OS=18.0
destination: platform=iOS Simulator,name=iPhone 16,OS=18.2
- name: watchOS
destination: platform=watchOS Simulator,name=Apple Watch Series 10 (46mm),OS=11.0
destination: platform=watchOS Simulator,name=Apple Watch Series 10 (46mm),OS=11.2
- name: tvOS
destination: platform=tvOS Simulator,name=Apple TV 4K (3rd generation),OS=18.0
destination: platform=tvOS Simulator,name=Apple TV 4K (3rd generation),OS=18.2
- name: visionOS
destination: platform=visionOS Simulator,name=Apple Vision Pro,OS=2.0
destination: platform=visionOS Simulator,name=Apple Vision Pro,OS=2.2
steps:
- name: Checkout
uses: actions/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ concurrency:
cancel-in-progress: true

env:
DEVELOPER_DIR: /Applications/Xcode_16.1.app/Contents/Developer
DEVELOPER_DIR: /Applications/Xcode_16.2.app/Contents/Developer

jobs:
analyze:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
build:
name: Build
runs-on: ubuntu-latest
container: swift:6.0-jammy
container: swift:6.0.2-jammy
steps:
- name: Checkout
uses: actions/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ concurrency:
cancel-in-progress: true

env:
DEVELOPER_DIR: /Applications/Xcode_16.1.app/Contents/Developer
DEVELOPER_DIR: /Applications/Xcode_16.2.app/Contents/Developer

jobs:
integration-test:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ concurrency:
cancel-in-progress: true

env:
DEVELOPER_DIR: /Applications/Xcode_16.1.app/Contents/Developer
DEVELOPER_DIR: /Applications/Xcode_16.2.app/Contents/Developer

jobs:
swiftFormat:
Expand Down
1 change: 1 addition & 0 deletions Sources/TMDb/Domain/Models/FacebookLink.swift
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ public struct FacebookLink: ExternalLink {
public init?(facebookID: String?) {
guard
let facebookID,
!facebookID.isEmpty,
let url = Self.facebookURL(for: facebookID)
else {
return nil
Expand Down
1 change: 1 addition & 0 deletions Sources/TMDb/Domain/Models/IMDbLink.swift
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ public struct IMDbLink: ExternalLink {
public init?(imdbNameID: String?) {
guard
let imdbNameID,
!imdbNameID.isEmpty,
let url = Self.imdbURL(forName: imdbNameID)
else {
return nil
Expand Down
1 change: 1 addition & 0 deletions Sources/TMDb/Domain/Models/InstagramLink.swift
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ public struct InstagramLink: ExternalLink {
public init?(instagramID: String?) {
guard
let instagramID,
!instagramID.isEmpty,
let url = Self.instagramURL(for: instagramID)
else {
return nil
Expand Down
1 change: 1 addition & 0 deletions Sources/TMDb/Domain/Models/TikTokLink.swift
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ public struct TikTokLink: ExternalLink {
public init?(tikTokID: String?) {
guard
let tikTokID,
!tikTokID.isEmpty,
let url = Self.tikTokURL(for: tikTokID)
else {
return nil
Expand Down
1 change: 1 addition & 0 deletions Sources/TMDb/Domain/Models/TwitterLink.swift
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ public struct TwitterLink: ExternalLink {
public init?(twitterID: String?) {
guard
let twitterID,
!twitterID.isEmpty,
let url = Self.twitterURL(for: twitterID)
else {
return nil
Expand Down
1 change: 1 addition & 0 deletions Sources/TMDb/Domain/Models/WikiDataLink.swift
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ public struct WikiDataLink: ExternalLink {
public init?(wikiDataID: String?) {
guard
let wikiDataID,
!wikiDataID.isEmpty,
let url = Self.wikiDataURL(for: wikiDataID)
else {
return nil
Expand Down
5 changes: 3 additions & 2 deletions Sources/TMDb/Domain/Services/People/TMDbPersonService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,9 @@ final class TMDbPersonService: PersonService {
return personList
}

func externalLinks(forPerson personID: Person.ID) async throws -> PersonExternalLinksCollection
{
func externalLinks(
forPerson personID: Person.ID
) async throws -> PersonExternalLinksCollection {
let request = PersonExternalLinksRequest(id: personID)

let linksCollection: PersonExternalLinksCollection
Expand Down
7 changes: 7 additions & 0 deletions Tests/TMDbTests/Domain/Models/FacebookLinkTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,13 @@ struct FacebookLinkTests {
#expect(facebookLink == nil)
}

@Test("Init with Facebook ID when ID is empty string returns nil")
func initWithFacebookIDWhenIDIsEmptyStringReturnsNil() {
let facebookLink = FacebookLink(facebookID: "")

#expect(facebookLink == nil)
}

@Test("Facebook URL")
func testURL() throws {
let facebookID = "BarbieTheMovie"
Expand Down
7 changes: 7 additions & 0 deletions Tests/TMDbTests/Domain/Models/IMDbLinkTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,13 @@ struct IMDbLinkTests {
#expect(imdbLink == nil)
}

@Test("init with IMDB name ID when ID is empty string returns nil")
func initWithIMDbNameIDWhenIDIsEmptyStringReturnsNil() {
let imdbLink = IMDbLink(imdbNameID: "")

#expect(imdbLink == nil)
}

@Test("URL when using title ID returns show URL")
func urlWhenUsingTitleIDReturnsShowURL() throws {
let imdbID = "tt1517268"
Expand Down
7 changes: 7 additions & 0 deletions Tests/TMDbTests/Domain/Models/InstagramLinkTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,13 @@ struct InstagramLinkTests {
#expect(instagramLink == nil)
}

@Test("init with instagramID when ID is empty string returns nil")
func initWithInstagramIDWhenIDIsEmptyStringReturnsNil() {
let instagramLink = InstagramLink(instagramID: "")

#expect(instagramLink == nil)
}

@Test("URL returns post URL")
func urlReturnsPostURL() throws {
let instagramID = "barbiethemovie"
Expand Down
7 changes: 7 additions & 0 deletions Tests/TMDbTests/Domain/Models/TikTokLinkTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,13 @@ struct TikTokLinkTests {
#expect(tikTokLink == nil)
}

@Test("init with TikTok ID when ID is empty string returns nil")
func initWithTikTokIDWhenIDIsEmptyStringReturnsNil() {
let tikTokLink = TikTokLink(tikTokID: "")

#expect(tikTokLink == nil)
}

@Test("url returns TikTok URL")
func urlReturnsTikTokURL() throws {
let tikTokID = "jasonstatham"
Expand Down
7 changes: 7 additions & 0 deletions Tests/TMDbTests/Domain/Models/TwitterLinkTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,13 @@ struct TwitterLinkTests {
#expect(twitterLint == nil)
}

@Test("init with twitterID when ID is empty string returns nil")
func initWithTwitterIDWhenIDIsEmptyStringReturnsNil() {
let twitterLint = TwitterLink(twitterID: "")

#expect(twitterLint == nil)
}

@Test("url returns Twitter URL")
func urlReturnsTwitterURL() throws {
let twitterID = "barbiethemovie"
Expand Down
7 changes: 7 additions & 0 deletions Tests/TMDbTests/Domain/Models/WikiDataLinkTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,13 @@ struct WikiDataLinkTests {
#expect(wikiDataLink == nil)
}

@Test("init with wikiDataID when ID is empty string returns nil")
func initWithWikiDataIDWhenIDIsEmptyStringReturnsNil() {
let wikiDataLink = WikiDataLink(wikiDataID: "")

#expect(wikiDataLink == nil)
}

@Test("url returns WikiData URL")
func urlReturnsWikiDataURL() throws {
let wikiDataID = "Q55436290"
Expand Down

0 comments on commit edbaefe

Please sign in to comment.