jan/web/utils/componentSettings.test.ts
Louis 846efb3126
test: add core modules test cases (#3498)
* chore: add core module test cases

* chore: fix tests

* chore: add code coverage report

* chore: split coverage step

* chore: split coverage step

* Update jan-electron-linter-and-test.yml

* Update jan-electron-linter-and-test.yml

* Update jan-electron-linter-and-test.yml

* chore: update tests

* chore: add web utils test cases

* chore: add restful and helper tests

* chore: add tests
2024-09-06 11:14:28 +07:00

23 lines
689 B
TypeScript

import { getConfigurationsData } from './componentSettings';
it('should process checkbox setting', () => {
const settings = { embedding: true };
const result = getConfigurationsData(settings);
expect(result[0].controllerProps.value).toBe(true);
});
it('should process input setting and handle array input', () => {
const settings = { prompt_template: ['Hello', 'World', ''] };
const result = getConfigurationsData(settings);
expect(result[0].controllerProps.value).toBe('Hello World ');
});
it('should return an empty array when settings object is empty', () => {
const settings = {};
const result = getConfigurationsData(settings);
expect(result).toEqual([]);
});