(t *testing.T)
| 609 | } |
| 610 | |
| 611 | func 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 | |
| 642 | func TestGetDefaultSyncFunction(t *testing.T) { |
| 643 | testCases := []struct { |
nothing calls this directly
no test coverage detected