Skip to content

Commit

Permalink
Fix type check issues from rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
eliperelman committed Oct 17, 2019
1 parent 84df2a8 commit a4678bc
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
8 changes: 4 additions & 4 deletions x-pack/plugins/licensing/public/__fixtures__/setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ import { coreMock } from '../../../../../src/core/public/mocks';
import { licenseMerge } from '../../common/license_merge';
import { Plugin } from '../plugin';

export function setupOnly(pluginInitializerContext: any = {}) {
export function setupOnly() {
const coreSetup = coreMock.createSetup();
const plugin = new Plugin(coreMock.createPluginInitializerContext(pluginInitializerContext));
const plugin = new Plugin(coreMock.createPluginInitializerContext());

return { coreSetup, plugin };
}

export async function setup(xpackInfo = {}, pluginInitializerContext: any = {}, shouldSkip = true) {
const { coreSetup, plugin } = setupOnly(pluginInitializerContext);
export async function setup(xpackInfo = {}, shouldSkip = true) {
const { coreSetup, plugin } = setupOnly();

coreSetup.http.get.mockResolvedValue(licenseMerge(xpackInfo));

Expand Down
2 changes: 1 addition & 1 deletion x-pack/plugins/licensing/public/license.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ describe('license', () => {
});

test('should return Unavailable if missing license', async () => {
({ plugin, license } = await setup({ license: null }, {}, false));
({ plugin, license } = await setup({ license: null }, false));

const { state } = license.check('test', 'gold');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
*/

import { RequestHandlerContext } from 'src/core/server';
import { LICENSE_STATUS } from '../../../../../licensing/server/constants';
import { LICENSE_CHECK_STATE } from '../../../../../licensing/server';

export const mockRouteContext = ({
licensing: {
license: {
check: jest.fn().mockReturnValue({
check: LICENSE_STATUS.Valid,
check: LICENSE_CHECK_STATE.Valid,
}),
},
},
Expand All @@ -21,7 +21,7 @@ export const mockRouteContextWithInvalidLicense = ({
licensing: {
license: {
check: jest.fn().mockReturnValue({
check: LICENSE_STATUS.Invalid,
check: LICENSE_CHECK_STATE.Invalid,
message: 'License is invalid for spaces',
}),
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import { RequestHandler } from 'src/core/server';
import { ObjectType } from '@kbn/config-schema';
import { LICENSE_STATUS } from '../../../../licensing/server/constants';
import { LICENSE_CHECK_STATE } from '../../../../licensing/server';

export const createLicensedRouteHandler = <
P extends ObjectType<any>,
Expand All @@ -19,8 +19,8 @@ export const createLicensedRouteHandler = <
const { license } = context.licensing;
const licenseCheck = license.check('spaces', 'basic');
if (
licenseCheck.check === LICENSE_STATUS.Unavailable ||
licenseCheck.check === LICENSE_STATUS.Invalid
licenseCheck.state === LICENSE_CHECK_STATE.Unavailable ||
licenseCheck.state === LICENSE_CHECK_STATE.Invalid
) {
return responseToolkit.forbidden({ body: { message: licenseCheck.message! } });
}
Expand Down

0 comments on commit a4678bc

Please sign in to comment.