Skip to content

Commit

Permalink
upd test coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
vitPinchuk committed Dec 11, 2024
1 parent 663e552 commit 8749a9e
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/utils/form-element.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -717,6 +717,20 @@ describe('Utils', () => {
expect(replaceVariables).toHaveBeenCalled();
expect(replaceVariables).toHaveBeenCalledWith(`const option = 'string'`);
});

it('Should not call replaceVariables if passed for getOptions helper with empty value', () => {
const replaceVariables = jest.fn((value: string) => value);
const element = {
type: FormElementType.SELECT,
optionsSource: OptionsSource.CODE,
getOptions: '',
} as any;

const localElement = toLocalFormElement(element, replaceVariables);
localElement.helpers.getOptions({ elements: [], data: {} as any });

expect(replaceVariables).not.toHaveBeenCalled();
});
});

describe('formValueHandler', () => {
Expand Down

0 comments on commit 8749a9e

Please sign in to comment.