Folders: Add validation that folder is not a parent of itself (#101569)
This commit is contained in:
committed by
GitHub
parent
e933f7cf01
commit
7c35d741ba
@@ -60,6 +60,18 @@ func TestIntegrationCreate(t *testing.T) {
|
||||
require.Error(t, err)
|
||||
})
|
||||
|
||||
t.Run("creating a folder with itself as a parent should fail", func(t *testing.T) {
|
||||
uid := util.GenerateShortUID()
|
||||
_, err := folderStore.Create(context.Background(), folder.CreateFolderCommand{
|
||||
Title: folderTitle,
|
||||
OrgID: orgID,
|
||||
ParentUID: uid,
|
||||
Description: folderDsc,
|
||||
UID: uid,
|
||||
})
|
||||
require.ErrorIs(t, err, folder.ErrFolderCannotBeParentOfItself)
|
||||
})
|
||||
|
||||
t.Run("creating a folder without providing a parent should default to the empty parent folder", func(t *testing.T) {
|
||||
uid := util.GenerateShortUID()
|
||||
f, err := folderStore.Create(context.Background(), folder.CreateFolderCommand{
|
||||
|
||||
Reference in New Issue
Block a user