Some checks failed
CI / init (pull_request) Has been cancelled
CI / Frontend node 18.16.0 (pull_request) Has been cancelled
CI / Backend go (1.22) (pull_request) Has been cancelled
CI / release-pr (pull_request) Has been cancelled
CI / devops-test (1.22, 18.16.0) (pull_request) Has been cancelled
CI / release-please (pull_request) Has been cancelled
CI / devops-prod (1.22, 18.x) (pull_request) Has been cancelled
CI / docker (pull_request) Has been cancelled
30 lines
1.1 KiB
Go
30 lines
1.1 KiB
Go
package book
|
|
|
|
import "testing"
|
|
|
|
func TestBookModelTableNames(t *testing.T) {
|
|
tests := []struct {
|
|
name string
|
|
got string
|
|
want string
|
|
}{
|
|
{name: "book", got: Book{}.TableName(), want: "book"},
|
|
{name: "book_author", got: BookAuthor{}.TableName(), want: "book_author"},
|
|
{name: "book_author_relation", got: BookAuthorRelation{}.TableName(), want: "book_author_relation"},
|
|
{name: "book_chapter", got: BookChapter{}.TableName(), want: "book_chapter"},
|
|
{name: "book_comment", got: BookComment{}.TableName(), want: "book_comment"},
|
|
{name: "book_comment_like_record", got: BookCommentLikeRecord{}.TableName(), want: "book_comment_like_record"},
|
|
{name: "book_favorite_record", got: BookFavoriteRecord{}.TableName(), want: "book_favorite_record"},
|
|
{name: "book_read_record", got: BookReadRecord{}.TableName(), want: "book_read_record"},
|
|
{name: "book_series", got: BookSeries{}.TableName(), want: "book_series"},
|
|
}
|
|
|
|
for _, tt := range tests {
|
|
t.Run(tt.name, func(t *testing.T) {
|
|
if tt.got != tt.want {
|
|
t.Fatalf("TableName() = %q, want %q", tt.got, tt.want)
|
|
}
|
|
})
|
|
}
|
|
}
|