Skip to content

Commit

Permalink
fix: fix unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
israx committed May 3, 2024
1 parent 0be6791 commit 376eadf
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion packages/api-graphql/__tests__/GraphQLAPI-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -757,7 +757,7 @@ describe('API test', () => {
variables,
authMode: GRAPHQL_AUTH_MODE.OPENID_CONNECT,
})
).rejects.toThrowError('No federated jwt');
).rejects.toThrowError('No current user');
});

test('multi-auth using CUP as auth mode, but no userpool', async () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/auth/__tests__/auth-unit-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3257,7 +3257,7 @@ describe('auth unit test', () => {
Username: 'username',
Pool: userPool,
});
const errorMessage = new NoUserPoolError(AuthErrorTypes.EmptyCode);
const errorMessage = new NoUserPoolError(AuthErrorTypes.MissingAuthConfig);

expect.assertions(2);
expect(auth.currentUserPoolUser().then()).rejects.toThrow(
Expand Down
4 changes: 3 additions & 1 deletion packages/auth/src/Auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1386,7 +1386,9 @@ export class AuthClass {
logger.debug('Getting current session');
// Purposely not calling the reject method here because we don't need a console error
if (!this.userPool) {
return Promise.reject();
return Promise.reject(new NoUserPoolError(
AuthErrorTypes.MissingAuthConfig
));
}

return new Promise((res, rej) => {
Expand Down
4 changes: 2 additions & 2 deletions packages/datastore/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@
"devDependencies": {
"@react-native-community/netinfo": "4.7.0",
"@types/uuid": "3.4.5",
"dexie": "3.0.3",
"dexie-export-import": "1.0.0-rc.2",
"dexie": "3.2.3",
"dexie-export-import": "1.0.3",
"fake-indexeddb": "3.0.0"
},
"dependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/predictions/__tests__/Predictions-unit-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ describe('Predictions test', () => {
predictions.convert(input, { providerName: 'WRONG_NAME' });
} catch (e) {
expect(e.message).toMatch(
"Cannot read property 'convert' of undefined"
"Cannot read properties of undefined (reading 'convert')"
);
}
});
Expand Down

0 comments on commit 376eadf

Please sign in to comment.