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

Function TestSyncFunction

channels/channelmapper_test.go:63–69  ·  view source on GitHub ↗

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

(t *testing.T)

Source from the content-addressed store, hash-verified

61
62// Just verify that the calls to the channel() fn show up in the output channel list.
63func TestSyncFunction(t *testing.T) {
64 ctx := base.TestCtx(t)
65 mapper := NewChannelMapper(ctx, `function(doc) {channel("foo", "bar"); channel("baz")}`, 0)
66 res, err := mapper.MapToChannelsAndAccess(ctx, parse(t, `{"channels": []}`), `{}`, emptyMetaMap(), noUser)
67 assert.NoError(t, err, "MapToChannelsAndAccess failed")
68 assert.Equal(t, BaseSetOf(t, "foo", "bar", "baz"), res.Channels)
69}
70
71// Just verify that the calls to the access() fn show up in the output channel list.
72func TestAccessFunction(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