mirror of
https://github.com/pocketbase/pocketbase.git
synced 2026-11-13 15:28:37 +01:00
[#2817] allowed 0 as RelationOptions.MinSelect value
This commit is contained in:
1 parent
2cb642bbf7
commit
7297f55ca4
3 files changed
+55
-1
No files matched your search
@@ -2112,6 +2112,22 @@ func TestRelationOptionsValidate(t *testing.T) {
|
||||
},
|
||||
[]string{"collectionId"},
|
||||
},
|
||||
{
|
||||
"MinSelect < 0",
|
||||
schema.RelationOptions{
|
||||
CollectionId: "abc",
|
||||
MinSelect: types.Pointer(-1),
|
||||
},
|
||||
[]string{"minSelect"},
|
||||
},
|
||||
{
|
||||
"MinSelect >= 0",
|
||||
schema.RelationOptions{
|
||||
CollectionId: "abc",
|
||||
MinSelect: types.Pointer(0),
|
||||
},
|
||||
[]string{},
|
||||
},
|
||||
{
|
||||
"MaxSelect <= 0",
|
||||
schema.RelationOptions{
|
||||
@@ -2128,6 +2144,42 @@ func TestRelationOptionsValidate(t *testing.T) {
|
||||
},
|
||||
[]string{},
|
||||
},
|
||||
{
|
||||
"MinSelect < MaxSelect",
|
||||
schema.RelationOptions{
|
||||
CollectionId: "abc",
|
||||
MinSelect: nil,
|
||||
MaxSelect: types.Pointer(1),
|
||||
},
|
||||
[]string{},
|
||||
},
|
||||
{
|
||||
"MinSelect = MaxSelect (non-zero)",
|
||||
schema.RelationOptions{
|
||||
CollectionId: "abc",
|
||||
MinSelect: types.Pointer(1),
|
||||
MaxSelect: types.Pointer(1),
|
||||
},
|
||||
[]string{},
|
||||
},
|
||||
{
|
||||
"MinSelect = MaxSelect (both zero)",
|
||||
schema.RelationOptions{
|
||||
CollectionId: "abc",
|
||||
MinSelect: types.Pointer(0),
|
||||
MaxSelect: types.Pointer(0),
|
||||
},
|
||||
[]string{"maxSelect"},
|
||||
},
|
||||
{
|
||||
"MinSelect > MaxSelect",
|
||||
schema.RelationOptions{
|
||||
CollectionId: "abc",
|
||||
MinSelect: types.Pointer(2),
|
||||
MaxSelect: types.Pointer(1),
|
||||
},
|
||||
[]string{"maxSelect"},
|
||||
},
|
||||
}
|
||||
|
||||
checkFieldOptionsScenarios(t, scenarios)
|
||||
|
||||
Reference in new issue
Block a user