mirror of
https://github.com/ipfs/kubo.git
synced 2026-02-21 18:37:45 +08:00
go-ipfs-config: Add one more test for config.Clone
This commit is contained in:
parent
3cd45d889a
commit
e4282bdb7a
@ -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 {
|
||||
@ -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")
|
||||
|
||||
Loading…
Reference in New Issue
Block a user