Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TEST: Add tests to TMDbClient #219

Merged
merged 1 commit into from
Nov 28, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
139 changes: 139 additions & 0 deletions Tests/TMDbTests/TMDbClientTests.swift
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)
}

}