test(settings): add unit test for the settings validator validateSelectionOptions function for test cases that should not throw an error

This commit is contained in:
2026-06-04 14:38:05 +02:00
committed by Gitea
parent bf317eea35
commit f4121bf419
2 changed files with 10 additions and 4 deletions
@@ -15,7 +15,7 @@ limitations under the License.
*/
import { describe, test, expect } from 'vitest';
import { assertType, assertString } from '../settingsValidator';
import { validateSelectionOptions, assertType, assertString } from '../settingsValidator';
describe('validateSettingsConfig', () => {
@@ -26,7 +26,13 @@ describe('validateEntry', () => {
});
describe('validateSelectionOptions', () => {
test.for([
[[{ name: 'test', i18n: 'test.label' }]],
[[{ name: 'test', i18n: 'test.label' }, { name: 'test2', i18n: 'test2.label' }]],
[[{ name: 'test', i18n: 'test.label' }, { name: 'test', i18n: 'test2.label' }, { name: 'test3', i18n: 'test.label' }]]
])('throws no error for the options %s', ([ options ]) => {
expect(() => validateSelectionOptions(options)).not.throws(Error);
});
});
describe('assertType', () => {