MCPcopy
hub / github.com/pocketbase/pocketbase / TestCollectionSerialize

Function TestCollectionSerialize

core/collection_model_test.go:642–761  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

640}
641
642func TestCollectionSerialize(t *testing.T) {
643 scenarios := []struct {
644 name string
645 collection func() *core.Collection
646 expected []string
647 notExpected []string
648 }{
649 {
650 "base",
651 func() *core.Collection {
652 c := core.NewCollection(core.CollectionTypeBase, "test")
653 c.ViewQuery = "1=1"
654 c.OAuth2.Providers = []core.OAuth2ProviderConfig{
655 {Name: "test1", ClientId: "test_client_id1", ClientSecret: "test_client_secret1"},
656 {Name: "test2", ClientId: "test_client_id2", ClientSecret: "test_client_secret2"},
657 }
658
659 return c
660 },
661 []string{
662 `"id":"pbc_`,
663 `"name":"test"`,
664 `"type":"base"`,
665 },
666 []string{
667 "verificationTemplate",
668 "manageRule",
669 "authRule",
670 "secret",
671 "oauth2",
672 "clientId",
673 "clientSecret",
674 "viewQuery",
675 },
676 },
677 {
678 "view",
679 func() *core.Collection {
680 c := core.NewCollection(core.CollectionTypeView, "test")
681 c.ViewQuery = "1=1"
682 c.OAuth2.Providers = []core.OAuth2ProviderConfig{
683 {Name: "test1", ClientId: "test_client_id1", ClientSecret: "test_client_secret1"},
684 {Name: "test2", ClientId: "test_client_id2", ClientSecret: "test_client_secret2"},
685 }
686
687 return c
688 },
689 []string{
690 `"id":"pbc_`,
691 `"name":"test"`,
692 `"type":"view"`,
693 `"viewQuery":"1=1"`,
694 },
695 []string{
696 "verificationTemplate",
697 "manageRule",
698 "authRule",
699 "secret",

Callers

nothing calls this directly

Calls 5

NewCollectionFunction · 0.92
collectionMethod · 0.80
RunMethod · 0.45
MarshalJSONMethod · 0.45
StringMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…