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

Function TestSyncFunctionTakesArray

channels/channelmapper_test.go:81–87  ·  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

79
80// Just verify that the calls to the channel() fn show up in the output channel list.
81func TestSyncFunctionTakesArray(t *testing.T) {
82 ctx := base.TestCtx(t)
83 mapper := NewChannelMapper(ctx, `function(doc) {channel(["foo", "bar ok","baz"])}`, 0)
84 res, err := mapper.MapToChannelsAndAccess(ctx, parse(t, `{"channels": []}`), `{}`, emptyMetaMap(), noUser)
85 assert.NoError(t, err, "MapToChannelsAndAccess failed")
86 assert.Equal(t, BaseSetOf(t, "foo", "bar ok", "baz"), res.Channels)
87}
88
89// Calling channel() with an invalid channel name should return an error.
90func TestSyncFunctionRejectsInvalidChannels(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