diff options
author | Vincent Tiu <46623413+Invincibot@users.noreply.github.com> | 2020-07-09 20:40:44 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-09 14:40:44 +0200 |
commit | f3304bdc1c215e733b9a2ee6a228e64f663c2b09 (patch) | |
tree | 44e21d3922b270dfe92a49361567775e684a292a /bug/bug_test.go | |
parent | de062a78ece6a33cc44d8bd3372d814b288ce916 (diff) | |
download | git-bug-f3304bdc1c215e733b9a2ee6a228e64f663c2b09.tar.gz |
Add functionality to remove bugs from a local repository. (#423)
Add functionality to remove bugs from a local repository.
This adds a function to remove git references in the repo and another one to remove bugs.
Diffstat (limited to 'bug/bug_test.go')
-rw-r--r-- | bug/bug_test.go | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/bug/bug_test.go b/bug/bug_test.go index 480d312e..43e760af 100644 --- a/bug/bug_test.go +++ b/bug/bug_test.go @@ -4,9 +4,10 @@ import ( "testing" "time" + "github.com/stretchr/testify/assert" + "github.com/MichaelMure/git-bug/identity" "github.com/MichaelMure/git-bug/repository" - "github.com/stretchr/testify/assert" ) func TestBugId(t *testing.T) { @@ -63,7 +64,7 @@ func TestBugValidity(t *testing.T) { } } -func TestBugCommitLoad(t *testing.T) { +func TestBugCommitLoadRemove(t *testing.T) { bug1 := NewBug() rene := identity.NewIdentity("René Descartes", "rene@descartes.fr") @@ -99,6 +100,16 @@ func TestBugCommitLoad(t *testing.T) { bug3, err := ReadLocalBug(repo, bug1.Id()) assert.NoError(t, err) equivalentBug(t, bug1, bug3) + + err = RemoveLocalBug(repo, bug1.Id()) + assert.NoError(t, err) + + streamedBugs := ReadAllLocalBugs(repo) + count := 0 + for range streamedBugs { + count++ + } + assert.Equal(t, 0, count) } func equivalentBug(t *testing.T, expected, actual *Bug) { |