github.com/machinebox/remoto@v0.1.2-0.20191024144331-eff21a7d321f/generator/definition/definition_test.go (about)

     1  package definition
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/matryer/is"
     7  )
     8  
     9  func TestStructure(t *testing.T) {
    10  	is := is.New(t)
    11  
    12  	struct1 := Structure{
    13  		Name: "StructureOne",
    14  	}
    15  	struct2 := Structure{
    16  		Name: "StructureTwo",
    17  	}
    18  	def := Definition{
    19  		Services: []Service{
    20  			{
    21  				Name:       "One",
    22  				Structures: []Structure{struct1},
    23  			},
    24  			{
    25  				Name:       "Two",
    26  				Structures: []Structure{struct2},
    27  			},
    28  		},
    29  	}
    30  	is.Equal(*def.Structure("StructureOne"), struct1)
    31  	is.Equal(*def.Structure("StructureTwo"), struct2)
    32  	is.True(def.Structure("Nope") == nil)
    33  }