Skip to content

Commit

Permalink
go-ipfs-config: Add one more test for config.Clone
Browse files Browse the repository at this point in the history
  • Loading branch information
magik6k authored and Stebalien committed Dec 14, 2018
1 parent 3cd45d8 commit e4282bd
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
func TestClone(t *testing.T) {
c := new(Config)
c.Identity.PeerID = "faketest"
c.API.HTTPHeaders = map[string][]string{"foo": []string{"bar"}}
c.API.HTTPHeaders = map[string][]string{"foo": {"bar"}}

newCfg, err := c.Clone()
if err != nil {
Expand All @@ -16,6 +16,12 @@ func TestClone(t *testing.T) {
if newCfg.Identity.PeerID != c.Identity.PeerID {
t.Fatal("peer ID not preserved")
}

c.API.HTTPHeaders["foo"] = []string{"baz"}
if newCfg.API.HTTPHeaders["foo"][0] != "bar" {
t.Fatal("HTTP headers not preserved")
}

delete(c.API.HTTPHeaders, "foo")
if newCfg.API.HTTPHeaders["foo"][0] != "bar" {
t.Fatal("HTTP headers not preserved")
Expand Down

0 comments on commit e4282bd

Please sign in to comment.