From f11a6aeb06c65e5ab54bf3cc36694845c812b6a7 Mon Sep 17 00:00:00 2001 From: Mike Cote Date: Mon, 17 Jun 2019 08:38:20 -0400 Subject: [PATCH] PR feedback pt3 --- .../validate_action_type_config.test.ts | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/x-pack/plugins/actions/server/__jest__/validate_action_type_config.test.ts b/x-pack/plugins/actions/server/__jest__/validate_action_type_config.test.ts index 8935f4b50ca2bd..d09362deae1d7a 100644 --- a/x-pack/plugins/actions/server/__jest__/validate_action_type_config.test.ts +++ b/x-pack/plugins/actions/server/__jest__/validate_action_type_config.test.ts @@ -65,3 +65,25 @@ test('should validate and throw error when actionTypeConfig is invalid', () => { `"actionTypeConfig invalid: child \\"param1\\" fails because [\\"param1\\" is required]"` ); }); + +test('should not return values when actionTypeConfig is invalid', () => { + expect(() => + validateActionTypeConfig( + { + id: 'my-action-type', + name: 'My action type', + validate: { + config: Joi.object() + .keys({ + param1: Joi.number().required(), + }) + .required(), + }, + async executor() {}, + }, + { param1: 'my secret value' } + ) + ).toThrowErrorMatchingInlineSnapshot( + `"actionTypeConfig invalid: child \\"param1\\" fails because [\\"param1\\" must be a number]"` + ); +});