github.com/alimy/mir/v4@v4.1.0/core/descriptor_test.go (about)

     1  // Copyright 2020 Michael Li <alimy@gility.net>. All rights reserved.
     2  // Use of this source code is governed by Apache License 2.0 that
     3  // can be found in the LICENSE file.
     4  
     5  package core
     6  
     7  import (
     8  	"testing"
     9  
    10  	"github.com/alimy/mir/v4"
    11  )
    12  
    13  func TestDescriptors(t *testing.T) {
    14  	d := make(Descriptors)
    15  	if err := d.Put(&IfaceDescriptor{
    16  		Group:    "",
    17  		Chain:    "Chain",
    18  		PkgName:  "api",
    19  		TypeName: "site",
    20  		Comment:  "",
    21  		Fields: []*FieldDescriptor{
    22  			{
    23  				Host:        "",
    24  				Path:        "/",
    25  				Queries:     nil,
    26  				HttpMethods: []string{mir.MethodGet},
    27  				MethodName:  "Index",
    28  				Comment:     "",
    29  			},
    30  		},
    31  	}); err != nil {
    32  		t.Error("want nil error but not")
    33  	}
    34  	if _, exist := d.Get(""); !exist {
    35  		t.Error("want exist an item but not")
    36  	}
    37  }