Skip to content

Commit

Permalink
bump(auth): lint fix
Browse files Browse the repository at this point in the history
  • Loading branch information
stephane-segning committed Dec 4, 2023
1 parent fabab9a commit 90fe3e1
Show file tree
Hide file tree
Showing 42 changed files with 242 additions and 242 deletions.
2 changes: 1 addition & 1 deletion packages/medusa-plugin-auth/src/api/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import AzureStrategy from '../auth-strategies/azure-oidc';

import { AuthOptions, AuthOptionsWrapper, handleOption } from '../types';

export default async function(rootDirectory, pluginOptions: AuthOptions[]): Promise<Router[]> {
export default async function (rootDirectory, pluginOptions: AuthOptions[]): Promise<Router[]> {
const configModule = loadConfig(rootDirectory);
return loadRouters(configModule, pluginOptions);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { AUTH0_ADMIN_STRATEGY_NAME, Auth0Options, ExtraParams } from '../../type
import { Profile } from 'passport-auth0';
import { getAuth0AdminStrategy } from '../../admin';

describe('Auth0 admin strategy verify callback', function() {
describe('Auth0 admin strategy verify callback', function () {
const existsEmail = '[email protected]';
const existsEmailWithProviderKey = '[email protected]';
const existsEmailWithWrongProviderKey = '[email protected]';
Expand Down Expand Up @@ -63,7 +63,7 @@ describe('Auth0 admin strategy verify callback', function() {
} as MedusaContainer;
});

describe('when strict is set to admin', function() {
describe('when strict is set to admin', function () {
beforeEach(() => {
const Auth0AdminStrategy = getAuth0AdminStrategy('test');
auth0AdminStrategy = new Auth0AdminStrategy(
Expand All @@ -75,7 +75,7 @@ describe('Auth0 admin strategy verify callback', function() {
clientSecret: 'fake',
admin: { callbackUrl: '/fakeCallbackUrl' },
} as Auth0Options,
'admin',
'admin'
);
});

Expand All @@ -92,7 +92,7 @@ describe('Auth0 admin strategy verify callback', function() {
expect(data).toEqual(
expect.objectContaining({
id: 'test2',
}),
})
);
});

Expand Down Expand Up @@ -130,7 +130,7 @@ describe('Auth0 admin strategy verify callback', function() {
});
});

describe('when strict is set for store only', function() {
describe('when strict is set for store only', function () {
beforeEach(() => {
const Auth0AdminStrategy = getAuth0AdminStrategy('test');
auth0AdminStrategy = new Auth0AdminStrategy(
Expand All @@ -142,7 +142,7 @@ describe('Auth0 admin strategy verify callback', function() {
clientSecret: 'fake',
admin: { callbackUrl: '/fakeCallbackUrl' },
} as Auth0Options,
'store',
'store'
);
});

Expand All @@ -159,7 +159,7 @@ describe('Auth0 admin strategy verify callback', function() {
expect(data).toEqual(
expect.objectContaining({
id: 'test2',
}),
})
);
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { AUTH0_STORE_STRATEGY_NAME, Auth0Options, ExtraParams } from '../../type
import { Profile } from 'passport-auth0';
import { getAuth0StoreStrategy } from '../../store';

describe('Auth0 store strategy verify callback', function() {
describe('Auth0 store strategy verify callback', function () {
const existsEmail = '[email protected]';
const existsEmailWithMeta = '[email protected]';
const existsEmailWithMetaAndProviderKey = '[email protected]';
Expand Down Expand Up @@ -37,12 +37,12 @@ describe('Auth0 store strategy verify callback', function() {
resolve: <T>(name: string): T => {
const container_ = {
manager: {
transaction: function(cb) {
transaction: function (cb) {
return cb();
},
},
customerService: {
withTransaction: function() {
withTransaction: function () {
return this;
},
create: createFn,
Expand Down Expand Up @@ -93,7 +93,7 @@ describe('Auth0 store strategy verify callback', function() {
} as MedusaContainer;
});

describe('when strict is set to store', function() {
describe('when strict is set to store', function () {
beforeEach(() => {
const Auth0StoreStrategy = getAuth0StoreStrategy('test');
auth0StoreStrategy = new Auth0StoreStrategy(
Expand All @@ -105,7 +105,7 @@ describe('Auth0 store strategy verify callback', function() {
clientSecret: 'fake',
store: { callbackUrl: '/fakeCallbackUrl' },
} as Auth0Options,
'store',
'store'
);
});

Expand All @@ -122,7 +122,7 @@ describe('Auth0 store strategy verify callback', function() {
expect(data).toEqual(
expect.objectContaining({
id: 'test3',
}),
})
);
});

Expand All @@ -146,7 +146,7 @@ describe('Auth0 store strategy verify callback', function() {
expect(data).toEqual(
expect.objectContaining({
id: 'test2',
}),
})
);
expect(updateFn).toHaveBeenCalledTimes(1);
});
Expand All @@ -160,7 +160,7 @@ describe('Auth0 store strategy verify callback', function() {
.validate(req, accessToken, refreshToken, extraParams, profile)
.catch((err) => err);
expect(err).toEqual(
new Error(`Customer with email ${existsEmailWithMetaButWrongProviderKey} already exists`),
new Error(`Customer with email ${existsEmailWithMetaButWrongProviderKey} already exists`)
);
});

Expand All @@ -177,13 +177,13 @@ describe('Auth0 store strategy verify callback', function() {
expect(data).toEqual(
expect.objectContaining({
id: 'test',
}),
})
);
expect(createFn).toHaveBeenCalledTimes(1);
});
});

describe('when strict is set to admin', function() {
describe('when strict is set to admin', function () {
beforeEach(() => {
const Auth0StoreStrategy = getAuth0StoreStrategy('test');
auth0StoreStrategy = new Auth0StoreStrategy(
Expand All @@ -195,7 +195,7 @@ describe('Auth0 store strategy verify callback', function() {
clientSecret: 'fake',
store: { callbackUrl: '/fakeCallbackUrl' },
} as Auth0Options,
'admin',
'admin'
);
});

Expand All @@ -212,7 +212,7 @@ describe('Auth0 store strategy verify callback', function() {
expect(data).toEqual(
expect.objectContaining({
id: 'test3',
}),
})
);
});

Expand All @@ -225,7 +225,7 @@ describe('Auth0 store strategy verify callback', function() {
expect(data).toEqual(
expect.objectContaining({
id: 'test',
}),
})
);
});

Expand All @@ -238,7 +238,7 @@ describe('Auth0 store strategy verify callback', function() {
expect(data).toEqual(
expect.objectContaining({
id: 'test2',
}),
})
);
expect(updateFn).toHaveBeenCalledTimes(1);
});
Expand All @@ -252,7 +252,7 @@ describe('Auth0 store strategy verify callback', function() {
expect(data).toEqual(
expect.objectContaining({
id: 'test4',
}),
})
);
});

Expand All @@ -269,7 +269,7 @@ describe('Auth0 store strategy verify callback', function() {
expect(data).toEqual(
expect.objectContaining({
id: 'test',
}),
})
);
expect(createFn).toHaveBeenCalledTimes(1);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export function getAuth0AdminStrategy(id: string): StrategyFactory<Auth0Options>
protected readonly container: MedusaContainer,
protected readonly configModule: ConfigModule,
protected readonly strategyOptions: Auth0Options,
protected readonly strict?: AuthProvider['strict'],
protected readonly strict?: AuthProvider['strict']
) {
super({
domain: strategyOptions.auth0Domain,
Expand All @@ -31,7 +31,7 @@ export function getAuth0AdminStrategy(id: string): StrategyFactory<Auth0Options>
accessToken: string,
refreshToken: string,
extraParams: ExtraParams,
profile: Profile,
profile: Profile
): Promise<null | { id: string; accessToken: string }> {
if (this.strategyOptions.admin.verifyCallback) {
const validateRes = await this.strategyOptions.admin.verifyCallback(
Expand All @@ -41,7 +41,7 @@ export function getAuth0AdminStrategy(id: string): StrategyFactory<Auth0Options>
refreshToken,
extraParams,
profile,
this.strict,
this.strict
);

return {
Expand Down Expand Up @@ -77,7 +77,7 @@ export function getAuth0AdminAuthRouter(id: string, auth0: Auth0Options, configM
authPath: auth0.admin.authPath ?? '/admin/auth/auth0',
authCallbackPath: auth0.admin.authCallbackPath ?? '/admin/auth/auth0/cb',
successRedirect: auth0.admin.successRedirect,
strategyName: AUTH0_ADMIN_STRATEGY_NAME,
strategyName,
passportAuthenticateMiddlewareOptions: {
scope: 'openid email profile',
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export function getAuth0StoreStrategy(id: string): StrategyFactory<Auth0Options>
protected readonly container: MedusaContainer,
protected readonly configModule: ConfigModule,
protected readonly strategyOptions: Auth0Options,
protected readonly strict?: AuthProvider['strict'],
protected readonly strict?: AuthProvider['strict']
) {
super({
domain: strategyOptions.auth0Domain,
Expand All @@ -31,7 +31,7 @@ export function getAuth0StoreStrategy(id: string): StrategyFactory<Auth0Options>
accessToken: string,
refreshToken: string,
extraParams: ExtraParams,
profile: Profile,
profile: Profile
): Promise<null | { id: string; accessToken: string }> {
if (this.strategyOptions.store.verifyCallback) {
const validateRes = await this.strategyOptions.store.verifyCallback(
Expand All @@ -41,7 +41,7 @@ export function getAuth0StoreStrategy(id: string): StrategyFactory<Auth0Options>
refreshToken,
extraParams,
profile,
this.strict,
this.strict
);

return {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export type Auth0Options = {
refreshToken: string,
extraParams: ExtraParams,
profile: Profile,
strict?: AuthProvider['strict'],
strict?: AuthProvider['strict']
) => Promise<null | { id: string } | never>;

expiresIn?: number;
Expand All @@ -65,7 +65,7 @@ export type Auth0Options = {
refreshToken: string,
extraParams: ExtraParams,
profile: Profile,
strict?: AuthProvider['strict'],
strict?: AuthProvider['strict']
) => Promise<null | { id: string } | never>;

expiresIn?: number;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { AUTH_PROVIDER_KEY, IStrategy } from '../../../../types';
import { AZURE_ADMIN_STRATEGY_NAME, AzureAuthOptions } from '../../types';
import { getAzureAdminStrategy } from '../../admin';

describe('Azure AD admin strategy verify callback', function() {
describe('Azure AD admin strategy verify callback', function () {
const existsEmail = '[email protected]';
const existsEmailWithProviderKey = '[email protected]';
const existsEmailWithWrongProviderKey = '[email protected]';
Expand Down Expand Up @@ -57,7 +57,7 @@ describe('Azure AD admin strategy verify callback', function() {
} as MedusaContainer;
});

describe('when strict is set to admin', function() {
describe('when strict is set to admin', function () {
beforeEach(() => {
const AzureAdminStrategy = getAzureAdminStrategy('test');
azureAdminStrategy = new AzureAdminStrategy(
Expand All @@ -74,7 +74,7 @@ describe('Azure AD admin strategy verify callback', function() {
allowHttpForRedirectUrl: true,
},
} as AzureAuthOptions,
'admin',
'admin'
);
});

Expand All @@ -91,7 +91,7 @@ describe('Azure AD admin strategy verify callback', function() {
expect(data).toEqual(
expect.objectContaining({
id: 'test2',
}),
})
);
});

Expand Down Expand Up @@ -123,7 +123,7 @@ describe('Azure AD admin strategy verify callback', function() {
});
});

describe('when strict is set to store', function() {
describe('when strict is set to store', function () {
beforeEach(() => {
const AzureAdminStrategy = getAzureAdminStrategy('test');
azureAdminStrategy = new AzureAdminStrategy(
Expand All @@ -140,7 +140,7 @@ describe('Azure AD admin strategy verify callback', function() {
allowHttpForRedirectUrl: true,
},
} as AzureAuthOptions,
'store',
'store'
);
});

Expand All @@ -157,7 +157,7 @@ describe('Azure AD admin strategy verify callback', function() {
expect(data).toEqual(
expect.objectContaining({
id: 'test2',
}),
})
);
});

Expand All @@ -170,7 +170,7 @@ describe('Azure AD admin strategy verify callback', function() {
expect(data).toEqual(
expect.objectContaining({
id: 'test',
}),
})
);
});

Expand All @@ -183,7 +183,7 @@ describe('Azure AD admin strategy verify callback', function() {
expect(data).toEqual(
expect.objectContaining({
id: 'test3',
}),
})
);
});

Expand Down
Loading

0 comments on commit 90fe3e1

Please sign in to comment.