Skip to content

Commit

Permalink
test: fix sign in for gql clients (#8464)
Browse files Browse the repository at this point in the history
  • Loading branch information
SwaySway authored Oct 15, 2021
1 parent 1161fd5 commit 0584918
Showing 1 changed file with 6 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -209,11 +209,8 @@ beforeAll(async () => {
},
});

// const authRes2AfterGroup: any = await authenticateUser(USERNAME2, TMP_PASSWORD, REAL_PASSWORD);
// const idToken2 = authRes2AfterGroup.getIdToken().getJwtToken();
await Auth.signOut();
await Auth.signIn(USERNAME2, REAL_PASSWORD);
const idToken2 = (await Auth.currentSession()).getIdToken().getJwtToken();
const authRes2AfterGroup: any = await authenticateUser(USERNAME2, TMP_PASSWORD, REAL_PASSWORD);
const idToken2 = authRes2AfterGroup.getIdToken().getJwtToken();
GRAPHQL_CLIENT_2 = new AWSAppSyncClient({
url: GRAPHQL_ENDPOINT,
region: AWS_REGION,
Expand All @@ -224,11 +221,8 @@ beforeAll(async () => {
},
});

// const authRes3: any = await authenticateUser(USERNAME3, TMP_PASSWORD, REAL_PASSWORD);
// const idToken3 = authRes3.getIdToken().getJwtToken();
await Auth.signOut();
await Auth.signIn(USERNAME3, REAL_PASSWORD);
const idToken3 = (await Auth.currentSession()).getIdToken().getJwtToken();
const authRes3: any = await authenticateUser(USERNAME3, TMP_PASSWORD, REAL_PASSWORD);
const idToken3 = authRes3.getIdToken().getJwtToken();
GRAPHQL_CLIENT_3 = new AWSAppSyncClient({
url: GRAPHQL_ENDPOINT,
region: AWS_REGION,
Expand All @@ -238,6 +232,8 @@ beforeAll(async () => {
jwtToken: () => idToken3,
},
});

// clear previous signed in user
await Auth.signOut();
await Auth.signIn(USERNAME1, REAL_PASSWORD);
const authCreds = await Auth.currentCredentials();
Expand Down

0 comments on commit 0584918

Please sign in to comment.