github.com/rzurga/go-swagger@v0.28.1-0.20211109195225-5d1f453ffa3a/cmd/swagger/commands/diff/difference_location_test.go (about) 1 package diff 2 3 import ( 4 "testing" 5 6 "github.com/stretchr/testify/assert" 7 ) 8 9 func TestDifferenceLocation_AddNode(t *testing.T) { 10 11 parentLocation := DifferenceLocation{URL: "http://bob", Method: "meth", Node: &Node{Field: "Parent", TypeName: "bobtype"}} 12 13 newLocation := parentLocation.AddNode(&Node{Field: "child1"}) 14 assert.Equal(t, newLocation.Node.ChildNode.Field, "child1") 15 16 newLocation2 := parentLocation.AddNode(&Node{Field: "child2"}) 17 assert.Equal(t, newLocation2.Node.ChildNode.Field, "child2") 18 19 }