Skip to content

Commit

Permalink
Add AWSAppSyncConfigurationTests
Browse files Browse the repository at this point in the history
  • Loading branch information
lawmicha committed Aug 21, 2024
1 parent ba10c1c commit 40ff37c
Showing 1 changed file with 31 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
//
// Copyright Amazon.com Inc. or its affiliates.
// All Rights Reserved.
//
// SPDX-License-Identifier: Apache-2.0
//

import XCTest
import AWSPluginsCore
@_spi(InternalAmplifyConfiguration) @testable import Amplify

final class AWSAppSyncConfigurationTests: XCTestCase {

func testSuccess() throws {
let config = AmplifyOutputsData(data: .init(
awsRegion: "us-east-1",
url: "http://www.example.com",
modelIntrospection: nil,
apiKey: "apiKey123",
defaultAuthorizationType: .amazonCognitoUserPools,
authorizationTypes: [.apiKey, .awsIAM]))
let encoder = JSONEncoder()
let data = try! encoder.encode(config)

let configuration = try AWSAppSyncConfiguration(with: .data(data))

XCTAssertEqual(configuration.region, "us-east-1")
XCTAssertEqual(configuration.endpoint, URL(string: "http://www.example.com")!)
XCTAssertEqual(configuration.apiKey, "apiKey123")
}
}

0 comments on commit 40ff37c

Please sign in to comment.