-
Notifications
You must be signed in to change notification settings - Fork 196
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7e45c94
commit 9c31f85
Showing
3 changed files
with
53 additions
and
3 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
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
51 changes: 51 additions & 0 deletions
51
...lugins/Internal/Tests/InternalAWSPinpointUnitTests/EndpointInformationProviderTests.swift
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,51 @@ | ||
// | ||
// Copyright Amazon.com Inc. or its affiliates. | ||
// All Rights Reserved. | ||
// | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// | ||
|
||
@_spi(InternalAWSPinpoint) @testable import InternalAWSPinpoint | ||
import XCTest | ||
|
||
class EndpointInformationProviderTests: XCTestCase { | ||
|
||
/// Given: DefaultEndpointInformationProvider | ||
/// When: endpointInfo() is called | ||
/// Then: endpoint information is returned not nil | ||
func testGetEndpointInformation() async { | ||
let provider = DefaultEndpointInformationProvider() | ||
let endpointInfo = await provider.endpointInfo() | ||
XCTAssertNotNil(endpointInfo) | ||
} | ||
|
||
/// Given: DefaultEndpointInformationProvider | ||
/// When: endpointInfo() is called | ||
/// Then: endpoint information returned contains platform name/version, app version, model, | ||
func testGetEndpointInformationDetails() async { | ||
let provider = DefaultEndpointInformationProvider() | ||
let endpointInfo = await provider.endpointInfo() | ||
let platformName = endpointInfo.platform.name | ||
let platformVersion = endpointInfo.platform.version | ||
let model = endpointInfo.model | ||
let version = endpointInfo.appVersion | ||
|
||
XCTAssertNotNil(platformName) | ||
XCTAssertNotNil(platformVersion) | ||
XCTAssertNotNil(model) | ||
XCTAssertNotNil(version) | ||
|
||
#if os(macOS) | ||
XCTAssertEqual(platformName, "macOS") | ||
#elseif os(iOS) | ||
XCTAssertEqual(platformName, "iOS") | ||
XCTAssertEqual(model, "iPhone") | ||
#elseif os(tvOS) | ||
XCTAssertEqual(platformName, "tvOS") | ||
XCTAssertEqual(model, "Apple TV") | ||
#elseif os(watchOS) | ||
XCTAssertEqual(platformName, "watchOS") | ||
XCTAssertEqual(model, "Apple Watch") | ||
#endif | ||
} | ||
} |