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

Function TestCollectionSyncFunction

channels/channelmapper_test.go:611–640  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

609}
610
611func TestCollectionSyncFunction(t *testing.T) {
612 testCases := []struct {
613 docBody string
614 name string
615 }{
616 {
617 docBody: `{"channels": ["foo", "bar", "baz"]}`,
618 name: "legacyDocBody",
619 },
620 {
621 docBody: `{"x": "y"}`,
622 name: "irrelevantData",
623 },
624 {
625 docBody: `{"x": "y"}`,
626 name: "irrelevantData",
627 },
628 }
629
630 for _, test := range testCases {
631 t.Run(test.name, func(t *testing.T) {
632 ctx := base.TestCtx(t)
633 collectionName := "barcollection"
634 mapper := NewChannelMapper(ctx, GetDefaultSyncFunction("fooscope", collectionName), 0)
635 res, err := mapper.MapToChannelsAndAccess(ctx, parse(t, test.docBody), `{}`, emptyMetaMap(), noUser)
636 require.NoError(t, err)
637 require.Equal(t, BaseSetOf(t, collectionName), res.Channels)
638 })
639 }
640}
641
642func TestGetDefaultSyncFunction(t *testing.T) {
643 testCases := []struct {

Callers

nothing calls this directly

Calls 9

TestCtxFunction · 0.92
NewChannelMapperFunction · 0.85
GetDefaultSyncFunctionFunction · 0.85
parseFunction · 0.85
emptyMetaMapFunction · 0.85
BaseSetOfFunction · 0.85
RunMethod · 0.65
EqualMethod · 0.45

Tested by

no test coverage detected