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

Function TestAccessFunction

channels/channelmapper_test.go:72–78  ·  view source on GitHub ↗

Just verify that the calls to the access() fn show up in the output channel list.

(t *testing.T)

Source from the content-addressed store, hash-verified

70
71// Just verify that the calls to the access() fn show up in the output channel list.
72func TestAccessFunction(t *testing.T) {
73 ctx := base.TestCtx(t)
74 mapper := NewChannelMapper(ctx, `function(doc) {access("foo", "bar"); access("foo", "baz")}`, 0)
75 res, err := mapper.MapToChannelsAndAccess(ctx, parse(t, `{}`), `{}`, emptyMetaMap(), noUser)
76 assert.NoError(t, err, "MapToChannelsAndAccess failed")
77 assert.Equal(t, AccessMap{"foo": BaseSetOf(t, "bar", "baz")}, res.Access)
78}
79
80// Just verify that the calls to the channel() fn show up in the output channel list.
81func TestSyncFunctionTakesArray(t *testing.T) {

Callers

nothing calls this directly

Calls 7

TestCtxFunction · 0.92
NewChannelMapperFunction · 0.85
parseFunction · 0.85
emptyMetaMapFunction · 0.85
BaseSetOfFunction · 0.85
EqualMethod · 0.45

Tested by

no test coverage detected