-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
TEST: Add tests to TMDbClient (#219)
- Loading branch information
1 parent
2cf0dd0
commit 4b230a1
Showing
1 changed file
with
139 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,139 @@ | ||
// | ||
// TMDbClientTests.swift | ||
// TMDb | ||
// | ||
// Copyright © 2024 Adam Young. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an AS IS BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
// | ||
|
||
import Foundation | ||
import Testing | ||
|
||
@testable import TMDb | ||
|
||
@Suite | ||
struct TMDbClientTests { | ||
|
||
var apiKey: String! | ||
|
||
init() { | ||
self.apiKey = "test-api-key" | ||
} | ||
|
||
@Test("init with API key creates account service") | ||
func initWithAPIKeyCreatesAccountService() { | ||
let client = TMDbClient(apiKey: apiKey) | ||
|
||
#expect(client.account is TMDbAccountService) | ||
} | ||
|
||
@Test("init with API key creates authentication service") | ||
func initWithAPIKeyCreatesAuthenticationService() { | ||
let client = TMDbClient(apiKey: apiKey) | ||
|
||
#expect(client.authentication is TMDbAuthenticationService) | ||
} | ||
|
||
@Test("init with API key creates certification service") | ||
func initWithAPIKeyCreatesCertificationService() { | ||
let client = TMDbClient(apiKey: apiKey) | ||
|
||
#expect(client.certifications is TMDbCertificationService) | ||
} | ||
|
||
@Test("init with API key creates company service") | ||
func initWithAPIKeyCreatesCompanyService() { | ||
let client = TMDbClient(apiKey: apiKey) | ||
|
||
#expect(client.companies is TMDbCompanyService) | ||
} | ||
|
||
@Test("init with API key creates configuration service") | ||
func initWithAPIKeyCreatesConfigurationService() { | ||
let client = TMDbClient(apiKey: apiKey) | ||
|
||
#expect(client.configurations is TMDbConfigurationService) | ||
} | ||
|
||
@Test("init with API key creates discover service") | ||
func initWithAPIKeyCreatesDiscoverService() { | ||
let client = TMDbClient(apiKey: apiKey) | ||
|
||
#expect(client.discover is TMDbDiscoverService) | ||
} | ||
|
||
@Test("init with API key creates genre service") | ||
func initWithAPIKeyCreatesGenreService() { | ||
let client = TMDbClient(apiKey: apiKey) | ||
|
||
#expect(client.genres is TMDbGenreService) | ||
} | ||
|
||
@Test("init with API key creates movie service") | ||
func initWithAPIKeyCreatesMovieService() { | ||
let client = TMDbClient(apiKey: apiKey) | ||
|
||
#expect(client.movies is TMDbMovieService) | ||
} | ||
|
||
@Test("init with API key creates person service") | ||
func initWithAPIKeyCreatesPersonService() { | ||
let client = TMDbClient(apiKey: apiKey) | ||
|
||
#expect(client.people is TMDbPersonService) | ||
} | ||
|
||
@Test("init with API key creates search service") | ||
func initWithAPIKeyCreatesSearchService() { | ||
let client = TMDbClient(apiKey: apiKey) | ||
|
||
#expect(client.search is TMDbSearchService) | ||
} | ||
|
||
@Test("init with API key creates trending service") | ||
func initWithAPIKeyCreatesTrendingService() { | ||
let client = TMDbClient(apiKey: apiKey) | ||
|
||
#expect(client.trending is TMDbTrendingService) | ||
} | ||
|
||
@Test("init with API key creates TV episode service") | ||
func initWithAPIKeyCreatesTVEpisodeService() { | ||
let client = TMDbClient(apiKey: apiKey) | ||
|
||
#expect(client.tvEpisodes is TMDbTVEpisodeService) | ||
} | ||
|
||
@Test("init with API key creates TV season service") | ||
func initWithAPIKeyCreatesTVSeasonService() { | ||
let client = TMDbClient(apiKey: apiKey) | ||
|
||
#expect(client.tvSeasons is TMDbTVSeasonService) | ||
} | ||
|
||
@Test("init with API key creates TV series service") | ||
func initWithAPIKeyCreatesTVSeriesService() { | ||
let client = TMDbClient(apiKey: apiKey) | ||
|
||
#expect(client.tvSeries is TMDbTVSeriesService) | ||
} | ||
|
||
@Test("init with API key creates watch provider service") | ||
func initWithAPIKeyCreatesWatchProviderService() { | ||
let client = TMDbClient(apiKey: apiKey) | ||
|
||
#expect(client.watchProviders is TMDbWatchProviderService) | ||
} | ||
|
||
} |