mirror of
https://github.com/johndoe6345789/metabuilder.git
synced 2026-04-26 06:44:58 +00:00
20 lines
907 B
TypeScript
20 lines
907 B
TypeScript
import { describe, expect, it } from 'vitest'
|
|
import { validateLuaScriptUpdate } from '../../../src/core/validation/validate-lua-script-update'
|
|
|
|
describe('validateLuaScriptUpdate', () => {
|
|
it.each([
|
|
{ data: { timeoutMs: 100 }, expected: [] },
|
|
{ data: { allowedGlobals: ['math', 'string'] }, expected: [] },
|
|
])('returns $expected for valid case', ({ data, expected }) => {
|
|
expect(validateLuaScriptUpdate(data)).toEqual(expected)
|
|
})
|
|
|
|
it.each([
|
|
{ data: { timeoutMs: 10 }, message: 'timeoutMs must be an integer between 100 and 30000' },
|
|
{ data: { allowedGlobals: ['ok', 1 as unknown as string] }, message: 'allowedGlobals must contain non-empty strings' },
|
|
{ data: { isSandboxed: 'yes' as unknown as boolean }, message: 'isSandboxed must be a boolean' },
|
|
])('rejects invalid case', ({ data, message }) => {
|
|
expect(validateLuaScriptUpdate(data)).toContain(message)
|
|
})
|
|
})
|