GH-3050 - Fix deleting empty property (#3249)

* remove check for blocks on patch, a delete may not have blocks

* remove no longer necessary tests

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
This commit is contained in:
Scott Bishel 2022-06-20 14:16:02 -06:00 committed by GitHub
parent 5979d19e73
commit 3e9219ab0f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 0 additions and 31 deletions

View file

@ -693,16 +693,6 @@ func TestDeleteBoardsAndBlocks(t *testing.T) {
require.False(t, success) require.False(t, success)
}) })
t.Run("no blocks", func(t *testing.T) {
dbab := &model.DeleteBoardsAndBlocks{
Boards: []string{board.ID},
}
success, resp := th.Client.DeleteBoardsAndBlocks(dbab)
th.CheckBadRequest(resp)
require.False(t, success)
})
t.Run("boards from different teams", func(t *testing.T) { t.Run("boards from different teams", func(t *testing.T) {
newOtherTeamsBoard := &model.Board{ newOtherTeamsBoard := &model.Board{
TeamID: "another-team-id", TeamID: "another-team-id",

View file

@ -94,10 +94,6 @@ func (dbab *DeleteBoardsAndBlocks) IsValid() error {
return ErrNoBoardsInBoardsAndBlocks return ErrNoBoardsInBoardsAndBlocks
} }
if len(dbab.Blocks) == 0 {
return ErrNoBlocksInBoardsAndBlocks
}
return nil return nil
} }
@ -131,10 +127,6 @@ func (dbab *PatchBoardsAndBlocks) IsValid() error {
return ErrBoardIDsAndPatchesMissmatchInBoardsAndBlocks return ErrBoardIDsAndPatchesMissmatchInBoardsAndBlocks
} }
if len(dbab.BlockIDs) == 0 {
return ErrNoBlocksInBoardsAndBlocks
}
if len(dbab.BlockIDs) != len(dbab.BlockPatches) { if len(dbab.BlockIDs) != len(dbab.BlockPatches) {
return ErrBlockIDsAndPatchesMissmatchInBoardsAndBlocks return ErrBlockIDsAndPatchesMissmatchInBoardsAndBlocks
} }

View file

@ -183,19 +183,6 @@ func TestIsValidPatchBoardsAndBlocks(t *testing.T) {
require.ErrorIs(t, pbab.IsValid(), ErrBoardIDsAndPatchesMissmatchInBoardsAndBlocks) require.ErrorIs(t, pbab.IsValid(), ErrBoardIDsAndPatchesMissmatchInBoardsAndBlocks)
}) })
t.Run("no block ids", func(t *testing.T) {
pbab := &PatchBoardsAndBlocks{
BoardIDs: []string{"board-id-1", "board-id-2"},
BoardPatches: []*BoardPatch{
{Title: &newTitle},
{Description: &newDescription},
},
BlockIDs: []string{},
}
require.ErrorIs(t, pbab.IsValid(), ErrNoBlocksInBoardsAndBlocks)
})
t.Run("missmatch block IDs and patches", func(t *testing.T) { t.Run("missmatch block IDs and patches", func(t *testing.T) {
pbab := &PatchBoardsAndBlocks{ pbab := &PatchBoardsAndBlocks{
BoardIDs: []string{"board-id-1", "board-id-2"}, BoardIDs: []string{"board-id-1", "board-id-2"},