github.com/thetreep/go-swagger@v0.0.0-20240223100711-35af64f14f01/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  }