97 lines
1.7 KiB
Go
97 lines
1.7 KiB
Go
|
package models
|
||
|
|
||
|
import "testing"
|
||
|
|
||
|
func TestTagAlias_TableName(t *testing.T) {
|
||
|
type fields struct {
|
||
|
Name string
|
||
|
TagID string
|
||
|
}
|
||
|
tests := []struct {
|
||
|
name string
|
||
|
fields fields
|
||
|
want string
|
||
|
}{
|
||
|
{
|
||
|
name: "Test 1: Is Name TagAlias",
|
||
|
fields: fields{},
|
||
|
want: "TagAlias",
|
||
|
},
|
||
|
}
|
||
|
for _, tt := range tests {
|
||
|
t.Run(tt.name, func(t *testing.T) {
|
||
|
ta := TagAlias{
|
||
|
Name: tt.fields.Name,
|
||
|
TagID: tt.fields.TagID,
|
||
|
}
|
||
|
if got := ta.TableName(); got != tt.want {
|
||
|
t.Errorf("TableName() = %v, want %v", got, tt.want)
|
||
|
}
|
||
|
})
|
||
|
}
|
||
|
}
|
||
|
|
||
|
func TestTagGroup_TableName(t *testing.T) {
|
||
|
type fields struct {
|
||
|
Name string
|
||
|
TagID string
|
||
|
}
|
||
|
tests := []struct {
|
||
|
name string
|
||
|
fields fields
|
||
|
want string
|
||
|
}{
|
||
|
{
|
||
|
name: "Test 1: Is name TagGroup",
|
||
|
fields: fields{},
|
||
|
want: "TagGroup",
|
||
|
},
|
||
|
}
|
||
|
for _, tt := range tests {
|
||
|
t.Run(tt.name, func(t *testing.T) {
|
||
|
ta := TagGroup{
|
||
|
Name: tt.fields.Name,
|
||
|
TagID: tt.fields.TagID,
|
||
|
}
|
||
|
if got := ta.TableName(); got != tt.want {
|
||
|
t.Errorf("TableName() = %v, want %v", got, tt.want)
|
||
|
}
|
||
|
})
|
||
|
}
|
||
|
}
|
||
|
|
||
|
func TestTag_TableName(t *testing.T) {
|
||
|
type fields struct {
|
||
|
Name string
|
||
|
Type TagType
|
||
|
Aliases []TagAlias
|
||
|
Groups []TagGroup
|
||
|
Posts []Post
|
||
|
}
|
||
|
tests := []struct {
|
||
|
name string
|
||
|
fields fields
|
||
|
want string
|
||
|
}{
|
||
|
{
|
||
|
name: "Test 1: Is name Tag",
|
||
|
fields: fields{},
|
||
|
want: "Tag",
|
||
|
},
|
||
|
}
|
||
|
for _, tt := range tests {
|
||
|
t.Run(tt.name, func(t *testing.T) {
|
||
|
ta := Tag{
|
||
|
Name: tt.fields.Name,
|
||
|
Type: tt.fields.Type,
|
||
|
Aliases: tt.fields.Aliases,
|
||
|
Groups: tt.fields.Groups,
|
||
|
Posts: tt.fields.Posts,
|
||
|
}
|
||
|
if got := ta.TableName(); got != tt.want {
|
||
|
t.Errorf("TableName() = %v, want %v", got, tt.want)
|
||
|
}
|
||
|
})
|
||
|
}
|
||
|
}
|