Skip to content

Commit

Permalink
Newsfeed test plugin: requests should match the current version only
Browse files Browse the repository at this point in the history
  • Loading branch information
afharo committed May 13, 2020
1 parent 578cc55 commit a239142
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
5 changes: 3 additions & 2 deletions test/common/fixtures/plugins/newsfeed/server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@
* under the License.
*/

import { PluginInitializerContext } from 'kibana/public';
import { NewsFeedSimulatorPlugin } from './plugin';

export function plugin() {
return new NewsFeedSimulatorPlugin();
export function plugin(initializerContext: PluginInitializerContext) {
return new NewsFeedSimulatorPlugin(initializerContext);
}
9 changes: 6 additions & 3 deletions test/common/fixtures/plugins/newsfeed/server/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,20 @@
* under the License.
*/

import { schema } from '@kbn/config-schema';
import { CoreSetup, Plugin } from 'kibana/server';
import { PluginInitializerContext } from 'kibana/public';

export class NewsFeedSimulatorPlugin implements Plugin {
constructor(private readonly initializerContext: PluginInitializerContext) {}

public setup({ http }: CoreSetup) {
const router = http.createRouter();
const version = this.initializerContext.env.packageInfo.version;

router.get(
{
path: '/api/_newsfeed-FTS-external-service-simulators/kibana/v{version}.json',
validate: { params: schema.object({ version: schema.string() }) },
path: `/api/_newsfeed-FTS-external-service-simulators/kibana/v${version}.json`,
validate: false,
options: { authRequired: false },
},
(context, req, res) => {
Expand Down

0 comments on commit a239142

Please sign in to comment.