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

This commit is contained in:
2026-06-04 13:53:47 +02:00
committed by Gitea
parent 39e6c94d09
commit 156b3b552c
2 changed files with 16 additions and 2 deletions
@@ -14,7 +14,8 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
import { describe } from 'vitest';
import { describe, test, expect } from 'vitest';
import { assertString } from '../settingsValidator';
describe('validateSettingsConfig', () => {
@@ -33,5 +34,18 @@ describe('assertType', () => {
});
describe('assertString', () => {
test.for([
[0],
[1],
[42],
[-1],
[-42],
[''],
[' '],
[' '],
[' ']
])('throws error for the value %s', ([ value ]) => {
expect(() => assertString(value)).throws(Error);
});
});