Fix: trigger err when move folder into itself (#1128)

This commit is contained in:
vvisionnn
2022-02-04 12:07:56 +08:00
committed by GitHub
parent c31c77a089
commit c84d0114ae
2 changed files with 15 additions and 1 deletions

View File

@ -493,7 +493,8 @@ func TestFolder_MoveOrCopyFolderTo_Move(t *testing.T) {
}
// 目标目录
dstFolder := Folder{
Model: gorm.Model{ID: 10},
Model: gorm.Model{ID: 10},
OwnerID: 1,
}
// 成功
@ -507,6 +508,12 @@ func TestFolder_MoveOrCopyFolderTo_Move(t *testing.T) {
asserts.NoError(mock.ExpectationsWereMet())
asserts.NoError(err)
}
// 移动自己到自己内部,失败
{
err := parFolder.MoveFolderTo([]uint{10, 2}, &dstFolder)
asserts.Error(err)
}
}
func TestFolder_FileInfoInterface(t *testing.T) {