diff options
author | Michael Muré <batolettre@gmail.com> | 2021-02-10 18:22:21 +0100 |
---|---|---|
committer | Michael Muré <batolettre@gmail.com> | 2021-02-14 12:19:03 +0100 |
commit | ef05c15f87468e0f4f1c688b0b9359cee2181c68 (patch) | |
tree | fba60b3d288ae6f6c2b8d8c18006e222c71807f5 /entity/dag/entity_actions_test.go | |
parent | f74166914c344329f08823770982f12966c79a77 (diff) | |
download | git-bug-ef05c15f87468e0f4f1c688b0b9359cee2181c68.tar.gz |
entity: implement remove
Diffstat (limited to 'entity/dag/entity_actions_test.go')
-rw-r--r-- | entity/dag/entity_actions_test.go | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/entity/dag/entity_actions_test.go b/entity/dag/entity_actions_test.go index 78baf41f..79afe525 100644 --- a/entity/dag/entity_actions_test.go +++ b/entity/dag/entity_actions_test.go @@ -385,3 +385,28 @@ func TestMerge(t *testing.T) { // fast-forward assertEqualRefs(t, repoA, repoB, "refs/"+def.namespace) } + +func TestRemove(t *testing.T) { + repoA, repoB, remote, id1, _, def := makeTestContextRemote(t) + defer repository.CleanupTestRepos(repoA, repoB, remote) + + e := New(def) + e.Append(newOp1(id1, "foo")) + require.NoError(t, e.Commit(repoA)) + + _, err := Push(def, repoA, "remote") + require.NoError(t, err) + + err = Remove(def, repoA, e.Id()) + require.NoError(t, err) + + _, err = Read(def, repoA, e.Id()) + require.Error(t, err) + + _, err = readRemote(def, repoA, "remote", e.Id()) + require.Error(t, err) + + // Remove is idempotent + err = Remove(def, repoA, e.Id()) + require.NoError(t, err) +} |