github.com/duskeagle/pop@v4.10.1-0.20190417200916-92f2b794aab5+incompatible/columns/readable_columns_test.go (about)

     1  package columns_test
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/gobuffalo/pop/columns"
     7  	"github.com/stretchr/testify/require"
     8  )
     9  
    10  func Test_Columns_ReadableString(t *testing.T) {
    11  	r := require.New(t)
    12  	for _, f := range []interface{}{foo{}, &foo{}} {
    13  		c := columns.ForStruct(f, "foo")
    14  		u := c.Readable().String()
    15  		r.Equal(u, "LastName, first_name, read")
    16  	}
    17  }
    18  
    19  func Test_Columns_Readable_SelectString(t *testing.T) {
    20  	r := require.New(t)
    21  	for _, f := range []interface{}{foo{}, &foo{}} {
    22  		c := columns.ForStruct(f, "foo")
    23  		u := c.Readable().SelectString()
    24  		r.Equal(u, "first_name as f, foo.LastName, foo.read")
    25  	}
    26  }
    27  
    28  func Test_Columns_ReadableString_Symbolized(t *testing.T) {
    29  	r := require.New(t)
    30  	for _, f := range []interface{}{foo{}, &foo{}} {
    31  		c := columns.ForStruct(f, "foo")
    32  		u := c.Readable().SymbolizedString()
    33  		r.Equal(u, ":LastName, :first_name, :read")
    34  	}
    35  }