Skip to content

Commit

Permalink
Register a system action using the sub actions framework
Browse files Browse the repository at this point in the history
  • Loading branch information
cnasikas committed Mar 6, 2024
1 parent e64be97 commit 58bd36b
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -82,4 +82,25 @@ describe('Registration', () => {
expect(mockRenderParameterTemplates).toHaveBeenCalledWith(logger, params, variables, actionId);
expect(rendered).toBe(renderedVariables);
});

it('registers a system connector correctly', async () => {
register<TestConfig, TestSecrets>({
actionTypeRegistry,
connector: { ...connector, isSystemActionType: true },
configurationUtilities: mockedActionsConfig,
logger,
});

expect(actionTypeRegistry.register).toHaveBeenCalledTimes(1);
expect(actionTypeRegistry.register).toHaveBeenCalledWith({
id: connector.id,
name: connector.name,
minimumLicenseRequired: connector.minimumLicenseRequired,
supportedFeatureIds: connector.supportedFeatureIds,
validate: expect.anything(),
executor: expect.any(Function),
renderParameterTemplates: expect.any(Function),
isSystemActionType: true,
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,6 @@ export const register = <Config extends ActionTypeConfig, Secrets extends Action
validate: validators,
executor,
renderParameterTemplates: connector.renderParameterTemplates,
isSystemActionType: connector.isSystemActionType,
});
};
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ export interface SubActionConnectorType<Config, Secrets> {
validators?: Array<ConfigValidator<Config> | SecretsValidator<Secrets>>;
getService: (params: ServiceParams<Config, Secrets>) => SubActionConnector<Config, Secrets>;
renderParameterTemplates?: RenderParameterTemplates<ExecutorParams>;
isSystemActionType?: boolean;
}

export interface ExecutorParams extends ActionTypeParams {
Expand Down

0 comments on commit 58bd36b

Please sign in to comment.