Skip to content

Commit

Permalink
refactor(core): Move VendurePlugin interface def into plugin dir
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelbromley committed Jul 19, 2019
1 parent 1e81068 commit 81b3dc8
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 11 deletions.
19 changes: 15 additions & 4 deletions packages/core/e2e/shop-auth.e2e-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,20 @@ import { DocumentNode } from 'graphql';
import gql from 'graphql-tag';
import path from 'path';

import { InjectorFn, VendurePlugin } from '../src/config/vendure-plugin/vendure-plugin';
import { EventBus } from '../src/event-bus/event-bus';
import { AccountRegistrationEvent } from '../src/event-bus/events/account-registration-event';
import { IdentifierChangeEvent } from '../src/event-bus/events/identifier-change-event';
import { IdentifierChangeRequestEvent } from '../src/event-bus/events/identifier-change-request-event';
import { PasswordResetEvent } from '../src/event-bus/events/password-reset-event';
import { InjectorFn, VendurePlugin } from '../src/plugin/vendure-plugin';

import { TEST_SETUP_TIMEOUT_MS } from './config/test-config';
import { CreateAdministrator, CreateRole, GetCustomer, Permission } from './graphql/generated-e2e-admin-types';
import {
CreateAdministrator,
CreateRole,
GetCustomer,
Permission,
} from './graphql/generated-e2e-admin-types';
import {
GetActiveCustomer,
RefreshToken,
Expand Down Expand Up @@ -391,12 +396,18 @@ describe('Shop auth & accounts', () => {
it(
'throws with bad token',
assertThrowsWithMessage(async () => {
await shopClient.query<UpdateEmailAddress.Mutation, UpdateEmailAddress.Variables>(UPDATE_EMAIL_ADDRESS, { token: 'bad token' });
await shopClient.query<UpdateEmailAddress.Mutation, UpdateEmailAddress.Variables>(
UPDATE_EMAIL_ADDRESS,
{ token: 'bad token' },
);
}, 'Identifier change token not recognized'),
);

it('verify the new email address', async () => {
const result = await shopClient.query<UpdateEmailAddress.Mutation, UpdateEmailAddress.Variables>(UPDATE_EMAIL_ADDRESS, { token: emailUpdateToken });
const result = await shopClient.query<UpdateEmailAddress.Mutation, UpdateEmailAddress.Variables>(
UPDATE_EMAIL_ADDRESS,
{ token: emailUpdateToken },
);
expect(result.updateCustomerEmailAddress).toBe(true);

expect(sendEmailFn).toHaveBeenCalled();
Expand Down
6 changes: 2 additions & 4 deletions packages/core/src/config/config.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { RequestHandler } from 'express';
import { ConnectionOptions } from 'typeorm';

import { ReadOnlyRequired } from '../common/types/common-types';
import { VendurePlugin } from '../plugin/vendure-plugin';

import { getConfig } from './config-helpers';
import { CustomFields } from './custom-field/custom-field-types';
Expand All @@ -22,7 +23,6 @@ import {
VendureConfig,
WorkerOptions,
} from './vendure-config';
import { VendurePlugin } from './vendure-plugin/vendure-plugin';

@Injectable()
export class ConfigService implements VendureConfig {
Expand All @@ -32,9 +32,7 @@ export class ConfigService implements VendureConfig {
this.activeConfig = getConfig();
if (this.activeConfig.authOptions.disableAuth) {
// tslint:disable-next-line
Logger.warn(
'Auth has been disabled. This should never be the case for a production system!',
);
Logger.warn('Auth has been disabled. This should never be the case for a production system!');
}
}

Expand Down
1 change: 0 additions & 1 deletion packages/core/src/config/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,3 @@ export * from './shipping-method/default-shipping-eligibility-checker';
export * from './shipping-method/shipping-calculator';
export * from './shipping-method/shipping-eligibility-checker';
export * from './vendure-config';
export * from './vendure-plugin/vendure-plugin';
2 changes: 1 addition & 1 deletion packages/core/src/config/vendure-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { ConnectionOptions } from 'typeorm';

import { Transitions } from '../common/finite-state-machine';
import { Order } from '../entity/order/order.entity';
import { VendurePlugin } from '../plugin/vendure-plugin';
import { OrderState } from '../service/helpers/order-state-machine/order-state';

import { AssetNamingStrategy } from './asset-naming-strategy/asset-naming-strategy';
Expand All @@ -23,7 +24,6 @@ import { ShippingCalculator } from './shipping-method/shipping-calculator';
import { ShippingEligibilityChecker } from './shipping-method/shipping-eligibility-checker';
import { TaxCalculationStrategy } from './tax/tax-calculation-strategy';
import { TaxZoneStrategy } from './tax/tax-zone-strategy';
import { VendurePlugin } from './vendure-plugin/vendure-plugin';

/**
* @description
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Provider } from '@nestjs/common';
import { Type } from '@vendure/common/lib/shared-types';
import { DocumentNode } from 'graphql';

import { VendureConfig } from '../vendure-config';
import { VendureConfig } from '../config/vendure-config';

/**
* @description
Expand Down

0 comments on commit 81b3dc8

Please sign in to comment.