Skip to content

Commit 9f81731

Browse files
committed
updated authfetchsigninsession tests to use GetTokenFromRefreshToken in mock clients
1 parent f386a64 commit 9f81731

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

AmplifyPlugins/Auth/Tests/AWSCognitoAuthPluginUnitTests/TaskTests/AuthorizationTests/AWSAuthFetchSignInSessionOperationTests.swift

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,9 @@ class AWSAuthFetchSignInSessionOperationTests: BaseAuthorizationTests {
9595
AuthorizationState.sessionEstablished(
9696
AmplifyCredentials.testData),
9797
.notStarted)
98-
let initAuth: MockIdentityProvider.MockInitiateAuthResponse = { _ in
98+
let getTokensFromRefreshToken: MockIdentityProvider.MockGetTokensFromRefreshTokenResponse = { _ in
9999
resultExpectation.fulfill()
100-
return InitiateAuthOutput(authenticationResult: .init(
100+
return GetTokensFromRefreshTokenOutput(authenticationResult: .init(
101101
accessToken: "accessToken",
102102
expiresIn: 1000,
103103
idToken: "idToken",
@@ -115,7 +115,7 @@ class AWSAuthFetchSignInSessionOperationTests: BaseAuthorizationTests {
115115
}
116116

117117
let plugin = configurePluginWith(
118-
userPool: { MockIdentityProvider(mockInitiateAuthResponse: initAuth) },
118+
userPool: { MockIdentityProvider(mockGetTokensFromRefreshTokenResponse: getTokensFromRefreshToken) },
119119
identityPool: { MockIdentity(mockGetCredentialsResponse: awsCredentials) },
120120
initialState: initialState)
121121
let session = try await plugin.fetchAuthSession(options: .forceRefresh())
@@ -212,11 +212,11 @@ class AWSAuthFetchSignInSessionOperationTests: BaseAuthorizationTests {
212212
AmplifyCredentials.testDataWithExpiredTokens),
213213
.notStarted)
214214

215-
let initAuth: MockIdentityProvider.MockInitiateAuthResponse = { _ in
215+
let getTokensFromRefreshToken: MockIdentityProvider.MockGetTokensFromRefreshTokenResponse = { _ in
216216
throw AWSCognitoIdentityProvider.NotAuthorizedException()
217217
}
218218

219-
let plugin = configurePluginWith(userPool: { MockIdentityProvider(mockInitiateAuthResponse: initAuth) }, initialState: initialState)
219+
let plugin = configurePluginWith(userPool: { MockIdentityProvider(mockGetTokensFromRefreshTokenResponse: getTokensFromRefreshToken) }, initialState: initialState)
220220
let session = try await plugin.fetchAuthSession(options: AuthFetchSessionRequest.Options())
221221
XCTAssertTrue(session.isSignedIn)
222222

@@ -261,8 +261,8 @@ class AWSAuthFetchSignInSessionOperationTests: BaseAuthorizationTests {
261261
AmplifyCredentials.testDataWithExpiredTokens),
262262
.notStarted)
263263

264-
let initAuth: MockIdentityProvider.MockInitiateAuthResponse = { _ in
265-
return InitiateAuthOutput(authenticationResult: .init(accessToken: "accessToken",
264+
let getTokensFromRefreshToken: MockIdentityProvider.MockGetTokensFromRefreshTokenResponse = { _ in
265+
return GetTokensFromRefreshTokenOutput(authenticationResult: .init(accessToken: "accessToken",
266266
expiresIn: 1000,
267267
idToken: "idToken",
268268
refreshToken: "refreshToke"))
@@ -273,7 +273,7 @@ class AWSAuthFetchSignInSessionOperationTests: BaseAuthorizationTests {
273273
}
274274

275275
let plugin = configurePluginWith(
276-
userPool: { MockIdentityProvider(mockInitiateAuthResponse: initAuth) },
276+
userPool: { MockIdentityProvider(mockGetTokensFromRefreshTokenResponse: getTokensFromRefreshToken) },
277277
identityPool: { MockIdentity(mockGetCredentialsResponse: awsCredentials) },
278278
initialState: initialState)
279279

0 commit comments

Comments
 (0)