Skip to content

Commit

Permalink
fixed test
Browse files Browse the repository at this point in the history
  • Loading branch information
YulNaumenko committed Oct 26, 2021
1 parent 6684e70 commit 8cf9415
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 21 deletions.
8 changes: 4 additions & 4 deletions x-pack/plugins/actions/server/actions_client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,8 @@ export class ActionsClient {
}

const actionType = this.actionTypeRegistry.get(actionTypeId);
let validatedActionTypeConfig = validateConfig(actionType, config);
let validatedActionTypeSecrets = validateSecrets(actionType, secrets);
const validatedActionTypeConfig = validateConfig(actionType, config);
const validatedActionTypeSecrets = validateSecrets(actionType, secrets);
if (actionType.validate?.connector) {
validateConnector(actionType, { config, secrets });
}
Expand Down Expand Up @@ -221,8 +221,8 @@ export class ActionsClient {
const { actionTypeId } = attributes;
const { name, config, secrets } = action;
const actionType = this.actionTypeRegistry.get(actionTypeId);
let validatedActionTypeConfig = validateConfig(actionType, config);
let validatedActionTypeSecrets = validateSecrets(actionType, secrets);
const validatedActionTypeConfig = validateConfig(actionType, config);
const validatedActionTypeSecrets = validateSecrets(actionType, secrets);
if (actionType.validate?.connector) {
validateConnector(actionType, { config, secrets });
}
Expand Down
11 changes: 3 additions & 8 deletions x-pack/plugins/actions/server/lib/action_executor.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -282,14 +282,9 @@ test('throws an error when connector is invalid', async () => {
config: schema.object({
param1: schema.string(),
}),
connector: schema.object({
config: schema.object({
param1: schema.string(),
}),
secrets: schema.object({
param2: schema.string(),
}),
}),
connector: () => {
return 'error';
},
},
executor: jest.fn(),
};
Expand Down
10 changes: 1 addition & 9 deletions x-pack/plugins/actions/server/lib/action_executor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,18 +152,10 @@ export class ActionExecutor {
validatedConfig = validateConfig(actionType, config as Record<string, unknown>);
validatedSecrets = validateSecrets(actionType, secrets as Record<string, unknown>);
if (actionType.validate?.connector) {
const validateActionTypeConnector = validateConnector(actionType, {
validateConnector(actionType, {
config: config as Record<string, unknown>,
secrets: secrets as Record<string, unknown>,
});
validatedConfig = {
...validatedConfig,
...(validateActionTypeConnector.config as Record<string, unknown>),
};
validatedSecrets = {
...validatedSecrets,
...(validateActionTypeConnector.secrets as Record<string, unknown>),
};
}
} catch (err) {
span?.setOutcome('failure');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,7 @@ export default function emailTest({ getService }: FtrProviderContext) {
config: {
service: '__json',
from: '[email protected]',
hasAuth: false,
},
})
.expect(200);
Expand Down

0 comments on commit 8cf9415

Please sign in to comment.