Files
xuanzhi-service/server/model/book/book_models_test.go
wdh-home 1e33640629
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
基础项目
2026-04-26 15:32:21 +08:00

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)
}
})
}
}