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

Function TestUserFunctionsMaxCodeSize

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

Source from the content-addressed store, hash-verified

458}
459
460func TestUserFunctionsMaxCodeSize(t *testing.T) {
461 var functionConfig = FunctionsConfig{
462 MaxCodeSize: base.Ptr(20),
463 Definitions: FunctionsDefs{
464 "square": &FunctionConfig{
465 Type: "javascript",
466 Code: "function(context, args) {return args.numero * args.numero;}",
467 Args: []string{"numero"},
468 Allow: &Allow{Channels: []string{"wonderland"}},
469 },
470 },
471 }
472 _, err := CompileFunctions(base.TestCtx(t), functionConfig)
473 assert.ErrorContains(t, err, "function code too large (> 20 bytes)")
474}
475
476// Low-level test of channel-name parameter expansion for user query/function auth
477func TestUserFunctionAllow(t *testing.T) {

Callers

nothing calls this directly

Calls 3

PtrFunction · 0.92
TestCtxFunction · 0.92
CompileFunctionsFunction · 0.85

Tested by

no test coverage detected