github.com/qri-io/qri@v0.10.1-0.20220104210721-c771715036cb/config/remote_test.go (about) 1 package config 2 3 import ( 4 "reflect" 5 "testing" 6 ) 7 8 func TestRemoteServerValidate(t *testing.T) { 9 rem := &RemoteServer{} 10 err := rem.Validate() 11 if err != nil { 12 t.Errorf("error validating remote: %s", err) 13 } 14 } 15 16 func TestRemoteServerCopy(t *testing.T) { 17 cases := []struct { 18 remote *RemoteServer 19 }{ 20 {&RemoteServer{}}, 21 } 22 for i, c := range cases { 23 cpy := c.remote.Copy() 24 if !reflect.DeepEqual(cpy, c.remote) { 25 t.Errorf("RemoteServer Copy test case %v, remote structs are not equal: \ncopy: %v, \noriginal: %v", i, cpy, c.remote) 26 continue 27 } 28 cpy.Enabled = true 29 if reflect.DeepEqual(cpy, c.remote) { 30 t.Errorf("RemoteServer Copy test case %v, editing one remote struct should not affect the other: \ncopy: %v, \noriginal: %v", i, cpy, c.remote) 31 continue 32 } 33 } 34 }