(t *testing.T)
| 437 | } |
| 438 | |
| 439 | func TestUserFunctionsMaxFunctionCount(t *testing.T) { |
| 440 | var twoFunctionConfig = FunctionsConfig{ |
| 441 | MaxFunctionCount: base.Ptr(1), |
| 442 | Definitions: FunctionsDefs{ |
| 443 | "square": &FunctionConfig{ |
| 444 | Type: "javascript", |
| 445 | Code: "function(context, args) {return args.numero * args.numero;}", |
| 446 | Args: []string{"numero"}, |
| 447 | Allow: &Allow{Channels: []string{"wonderland"}}, |
| 448 | }, |
| 449 | "exceptional": &FunctionConfig{ |
| 450 | Type: "javascript", |
| 451 | Code: `function(context, args) {throw "oops";}`, |
| 452 | Allow: allowAll, |
| 453 | }, |
| 454 | }, |
| 455 | } |
| 456 | _, err := CompileFunctions(base.TestCtx(t), twoFunctionConfig) |
| 457 | assert.ErrorContains(t, err, "too many functions declared (> 1)") |
| 458 | } |
| 459 | |
| 460 | func TestUserFunctionsMaxCodeSize(t *testing.T) { |
| 461 | var functionConfig = FunctionsConfig{ |
nothing calls this directly
no test coverage detected