From ce57c16d4d6a50c38a9c1b176497bc339baeb96f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alejandro=20Ferna=CC=81ndez=20Haro?= Date: Wed, 18 Dec 2019 14:14:34 +0000 Subject: [PATCH] Fix new functional tests --- .../plugins/core_plugin_b/server/plugin.ts | 6 +++--- .../test_suites/core_plugins/server_plugins.ts | 10 +++++++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/test/plugin_functional/plugins/core_plugin_b/server/plugin.ts b/test/plugin_functional/plugins/core_plugin_b/server/plugin.ts index a475967e8f0d7..862044e4be86c 100644 --- a/test/plugin_functional/plugins/core_plugin_b/server/plugin.ts +++ b/test/plugin_functional/plugins/core_plugin_b/server/plugin.ts @@ -38,9 +38,9 @@ export class CorePluginBPlugin implements Plugin { router.post( { - path: '/core_plugin_b/:id', + path: '/core_plugin_b', validate: { - params: schema.object({ id: schema.string() }), + query: schema.object({ id: schema.string() }), body: ({ ok, fail }, { bar, baz } = {}) => { if (typeof bar === 'string' && bar === baz) { return ok({ bar, baz }); @@ -51,7 +51,7 @@ export class CorePluginBPlugin implements Plugin { }, }, async (context, req, res) => { - return res.ok({ body: `ID: ${req.params.id} - ${req.body.bar.toUpperCase()}` }); + return res.ok({ body: `ID: ${req.query.id} - ${req.body.bar.toUpperCase()}` }); } ); } diff --git a/test/plugin_functional/test_suites/core_plugins/server_plugins.ts b/test/plugin_functional/test_suites/core_plugins/server_plugins.ts index 22332067acc49..d437912c1b69a 100644 --- a/test/plugin_functional/test_suites/core_plugins/server_plugins.ts +++ b/test/plugin_functional/test_suites/core_plugins/server_plugins.ts @@ -32,15 +32,19 @@ export default function({ getService }: PluginFunctionalProviderContext) { it('extend request handler context with validation', async () => { await supertest - .post('/core_plugin_b/TEST') + .post('/core_plugin_b') + .set('kbn-xsrf', 'anything') + .query({ id: 'TEST' }) .send({ bar: 'hi!', baz: 'hi!' }) .expect(200) .expect('ID: TEST - HI!'); }); - it('extend request handler context with validation', async () => { + it('extend request handler context with validation (400)', async () => { await supertest - .post('/core_plugin_b/TEST') + .post('/core_plugin_b') + .set('kbn-xsrf', 'anything') + .query({ id: 'TEST' }) .send({ bar: 'hi!', baz: 1234 }) .expect(400) .expect({