39 lines
760 B
Go
39 lines
760 B
Go
|
package models
|
||
|
|
||
|
import "testing"
|
||
|
|
||
|
func TestPost_TableName(t *testing.T) {
|
||
|
type fields struct {
|
||
|
BaseModel BaseModel
|
||
|
Rating Rating
|
||
|
Tags []Tag
|
||
|
Favorites []UserFavorites
|
||
|
References []PostReference
|
||
|
}
|
||
|
tests := []struct {
|
||
|
name string
|
||
|
fields fields
|
||
|
want string
|
||
|
}{
|
||
|
{
|
||
|
name: "Test 1: Is name Post",
|
||
|
fields: fields{},
|
||
|
want: "Post",
|
||
|
},
|
||
|
}
|
||
|
for _, tt := range tests {
|
||
|
t.Run(tt.name, func(t *testing.T) {
|
||
|
po := Post{
|
||
|
BaseModel: tt.fields.BaseModel,
|
||
|
Rating: tt.fields.Rating,
|
||
|
Tags: tt.fields.Tags,
|
||
|
Favorites: tt.fields.Favorites,
|
||
|
References: tt.fields.References,
|
||
|
}
|
||
|
if got := po.TableName(); got != tt.want {
|
||
|
t.Errorf("TableName() = %v, want %v", got, tt.want)
|
||
|
}
|
||
|
})
|
||
|
}
|
||
|
}
|