Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add unit test coverage #1085

Merged
merged 10 commits into from
Dec 4, 2024
Prev Previous commit
fix(builtins): add minor fix for divide, interpolation and shell plugins
manushak committed Dec 2, 2024

Verified

This commit was signed with the committer’s verified signature.
manushak Manushak Keramyan
commit 46a9f06a732aeea86a0c0837ef320d25ace4b322
4 changes: 1 addition & 3 deletions src/if-run/builtins/divide/index.ts
Original file line number Diff line number Diff line change
@@ -74,9 +74,7 @@ const calculateDivide = (
) => {
const {denominator, numerator} = params;
const finalDenominator =
typeof denominator === 'number'
? denominator
: input[denominator] || denominator;
typeof denominator === 'number' ? denominator : input[denominator];
const finalNumerator =
typeof numerator === 'number' ? numerator : input[numerator];

7 changes: 2 additions & 5 deletions src/if-run/builtins/exponent/index.ts
Original file line number Diff line number Diff line change
@@ -31,10 +31,7 @@ export const Exponent = PluginFactory({
inputValidation: (input: PluginParams, config: ConfigParams) => {
const inputParameter = config['input-parameter'];
const inputData = {
[inputParameter]:
typeof inputParameter === 'number'
? inputParameter
: input[inputParameter],
[inputParameter]: input[inputParameter],
};
const validationSchema = z.record(z.string(), z.number());

@@ -43,7 +40,7 @@ export const Exponent = PluginFactory({
inputData
);
},
implementation: async (inputs: PluginParams[], config: ConfigParams = {}) => {
implementation: async (inputs: PluginParams[], config: ConfigParams) => {
const {
'input-parameter': inputParameter,
exponent,
2 changes: 1 addition & 1 deletion src/if-run/builtins/shell/index.ts
Original file line number Diff line number Diff line change
@@ -15,7 +15,7 @@ const {MISSING_CONFIG} = STRINGS;

export const Shell = PluginFactory({
configValidation: (config: ConfigParams) => {
if (!config) {
if (!config || !Object.keys(config)?.length) {
throw new ConfigError(MISSING_CONFIG);
}