Skip to content

Commit

Permalink
Fixed broken test after merge
Browse files Browse the repository at this point in the history
  • Loading branch information
Steve Hobbs committed Feb 11, 2020
1 parent 42246e3 commit 208d722
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
5 changes: 3 additions & 2 deletions __tests__/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import createAuth0Client, {
PopupConfigOptions,
GetTokenSilentlyOptions
} from '../src/index';

import { AuthenticationError } from '../src/errors';
import version from '../src/version';
const GET_TOKEN_SILENTLY_LOCK_KEY = 'auth0.lock.getTokenSilently';
Expand Down Expand Up @@ -39,7 +40,7 @@ const TEST_TELEMETRY_QUERY_STRING = `&auth0Client=${encodeURIComponent(
)
)}`;

const DEFAULT_POPUP_CONFIG_OPTIONS: PopupConfigOptions = {};
import { DEFAULT_POPUP_CONFIG_OPTIONS } from '../src/constants';

const mockEnclosedCache = {
get: jest.fn(),
Expand Down Expand Up @@ -283,7 +284,7 @@ describe('Auth0', () => {
const { auth0, utils } = await setup({ authorizeTimeoutInSeconds: 1 });
const popup = {};
utils.openPopup.mockReturnValue(popup);
await auth0.loginWithPopup({}, DEFAULT_POPUP_CONFIG_OPTIONS);
await auth0.loginWithPopup({});
expect(utils.runPopup).toHaveBeenCalledWith(
popup,
`https://test.auth0.com/authorize?${TEST_QUERY_PARAMS}${TEST_TELEMETRY_QUERY_STRING}`,
Expand Down
11 changes: 8 additions & 3 deletions src/Auth0Client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ import TransactionManager from './transaction-manager';
import { verify as verifyIdToken } from './jwt';
import { AuthenticationError, GenericError } from './errors';
import * as ClientStorage from './storage';
import { DEFAULT_POPUP_CONFIG_OPTIONS } from './constants';
import {
DEFAULT_POPUP_CONFIG_OPTIONS,
DEFAULT_AUTHORIZE_TIMEOUT_IN_SECONDS
} from './constants';
import version from './version';
import {
Auth0ClientOptions,
Expand Down Expand Up @@ -225,7 +228,7 @@ export default class Auth0Client {
*/
public async loginWithPopup(
options: PopupLoginOptions = {},
config: PopupConfigOptions = DEFAULT_POPUP_CONFIG_OPTIONS
config: PopupConfigOptions = {}
) {
const popup = await openPopup();
const { ...authorizeOptions } = options;
Expand All @@ -251,7 +254,9 @@ export default class Auth0Client {
const codeResult = await runPopup(popup, url, {
...config,
timeoutInSeconds:
config.timeoutInSeconds || this.options.authorizeTimeoutInSeconds
config.timeoutInSeconds ||
this.options.authorizeTimeoutInSeconds ||
DEFAULT_AUTHORIZE_TIMEOUT_IN_SECONDS
});

if (stateIn !== codeResult.state) {
Expand Down

0 comments on commit 208d722

Please sign in to comment.