Skip to content

Commit

Permalink
Merge pull request ipfs#144 from RTradeLtd/test/patch-create
Browse files Browse the repository at this point in the history
Add Test for PatchLink for create == false
  • Loading branch information
Stebalien committed Dec 11, 2018
2 parents ed4d201 + 72217c1 commit cfc216e
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion shell_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -223,10 +223,19 @@ func TestPatch_rmLink(t *testing.T) {
func TestPatchLink(t *testing.T) {
is := is.New(t)
s := NewShell(shellUrl)

newRoot, err := s.PatchLink(examplesHash, "about", "QmUXTtySmd7LD4p6RG6rZW6RuUuPZXTtNMmRQ6DSQo3aMw", true)
is.Nil(err)
is.Equal(newRoot, "QmVfe7gesXf4t9JzWePqqib8QSifC1ypRBGeJHitSnF7fA")
newRoot, err = s.PatchLink(examplesHash, "about", "QmUXTtySmd7LD4p6RG6rZW6RuUuPZXTtNMmRQ6DSQo3aMw", false)
is.Nil(err)
is.Equal(newRoot, "QmVfe7gesXf4t9JzWePqqib8QSifC1ypRBGeJHitSnF7fA")
newHash, err := s.NewObject("unixfs-dir")
is.Nil(err)
_, err = s.PatchLink(newHash, "a/b/c", newHash, false)
is.NotNil(err)
newHash, err = s.PatchLink(newHash, "a/b/c", newHash, true)
is.Nil(err)
is.Equal(newHash, "QmQ5D3xbMWFQRC9BKqbvnSnHri31GqvtWG1G6rE8xAZf1J")
}

func TestResolvePath(t *testing.T) {
Expand Down

0 comments on commit cfc216e

Please sign in to comment.