MCPcopy Create free account
hub / github.com/couchbase/sync_gateway / TestUserFunctionsMaxFunctionCount

Function TestUserFunctionsMaxFunctionCount

db/functions/function_test.go:439–458  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

437}
438
439func 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
460func TestUserFunctionsMaxCodeSize(t *testing.T) {
461 var functionConfig = FunctionsConfig{

Callers

nothing calls this directly

Calls 3

PtrFunction · 0.92
TestCtxFunction · 0.92
CompileFunctionsFunction · 0.85

Tested by

no test coverage detected