1
0

fix(project): duplicating a project should not create two backlog buckets

Resolves https://community.vikunja.io/t/when-duplicating-a-project-the-resulting-project-has-an-extra-bucket/1524
This commit is contained in:
kolaente
2023-08-23 16:19:42 +02:00
parent acb03c430e
commit 5e8084c194
4 changed files with 24 additions and 11 deletions

View File

@ -44,6 +44,14 @@ func TestProjectDuplicate(t *testing.T) {
assert.True(t, can)
err = l.Create(s, u)
assert.NoError(t, err)
// assert the new project has the same number of buckets as the old one
numberOfOriginalBuckets, err := s.Where("project_id = ?", l.ProjectID).Count(&Bucket{})
assert.NoError(t, err)
numberOfDuplicatedBuckets, err := s.Where("project_id = ?", l.Project.ID).Count(&Bucket{})
assert.NoError(t, err)
assert.Equal(t, numberOfOriginalBuckets, numberOfDuplicatedBuckets, "duplicated project does not have the same amount of buckets as the original one")
// To make this test 100% useful, it would need to assert a lot more stuff, but it is good enough for now.
// Also, we're lacking utility functions to do all needed assertions.
}