MCPcopy
hub / github.com/pocketbase/pocketbase / TestCollectionDelete

Function TestCollectionDelete

core/collection_model_test.go:925–1021  ·  view source on GitHub ↗

-------------------------------------------------------------------

(t *testing.T)

Source from the content-addressed store, hash-verified

923// -------------------------------------------------------------------
924
925func TestCollectionDelete(t *testing.T) {
926 t.Parallel()
927
928 scenarios := []struct {
929 name string
930 collection string
931 disableIntegrityChecks bool
932 expectError bool
933 }{
934 {
935 name: "unsaved",
936 collection: "",
937 expectError: true,
938 },
939 {
940 name: "system",
941 collection: core.CollectionNameSuperusers,
942 expectError: true,
943 },
944 {
945 name: "base with references",
946 collection: "demo1",
947 expectError: true,
948 },
949 {
950 name: "base with references with disabled integrity checks",
951 collection: "demo1",
952 disableIntegrityChecks: true,
953 expectError: false,
954 },
955 {
956 name: "base without references",
957 collection: "demo1",
958 expectError: true,
959 },
960 {
961 name: "view with reference",
962 collection: "view1",
963 expectError: true,
964 },
965 {
966 name: "view with references with disabled integrity checks",
967 collection: "view1",
968 disableIntegrityChecks: true,
969 expectError: false,
970 },
971 {
972 name: "view without references",
973 collection: "view2",
974 disableIntegrityChecks: true,
975 expectError: false,
976 },
977 }
978
979 for _, s := range scenarios {
980 t.Run(s.name, func(t *testing.T) {
981 app, _ := tests.NewTestApp()
982 defer app.Cleanup()

Callers

nothing calls this directly

Calls 10

CleanupMethod · 0.95
IntegrityChecksMethod · 0.95
NewTestAppFunction · 0.92
NewBaseCollectionFunction · 0.92
DeleteMethod · 0.65
HasTableMethod · 0.65
IsNewMethod · 0.65
RunMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…