Test that JS syntax errors are detected when the db opens.
(t *testing.T)
| 418 | |
| 419 | // Test that JS syntax errors are detected when the db opens. |
| 420 | func TestUserFunctionSyntaxError(t *testing.T) { |
| 421 | var kUserFunctionBadConfig = FunctionsConfig{ |
| 422 | Definitions: FunctionsDefs{ |
| 423 | "square": &FunctionConfig{ |
| 424 | Code: "return args.numero * args.numero;", |
| 425 | Args: []string{"numero"}, |
| 426 | Allow: &Allow{Channels: []string{"wonderland"}}, |
| 427 | }, |
| 428 | "syntax_error": &FunctionConfig{ |
| 429 | Code: "returm )42(", |
| 430 | Allow: allowAll, |
| 431 | }, |
| 432 | }, |
| 433 | } |
| 434 | |
| 435 | _, err := CompileFunctions(base.TestCtx(t), kUserFunctionBadConfig) |
| 436 | assert.Error(t, err) |
| 437 | } |
| 438 | |
| 439 | func TestUserFunctionsMaxFunctionCount(t *testing.T) { |
| 440 | var twoFunctionConfig = FunctionsConfig{ |
nothing calls this directly
no test coverage detected