书籍模块
This commit is contained in:
@@ -5,6 +5,7 @@ import (
|
||||
"testing"
|
||||
|
||||
"github.com/flipped-aurora/gin-vue-admin/server/model/book"
|
||||
commonModel "github.com/flipped-aurora/gin-vue-admin/server/model/common"
|
||||
)
|
||||
|
||||
func TestValidateBookRejectsOutOfRangeAggregates(t *testing.T) {
|
||||
@@ -51,6 +52,15 @@ func TestValidateBookAuthorRejectsInvalidStatus(t *testing.T) {
|
||||
assertValidationErrorContains(t, err, "authorStatus")
|
||||
}
|
||||
|
||||
func TestValidateBookAuthorAcceptsCommonEnabledStatus(t *testing.T) {
|
||||
if err := validateBookAuthor(book.BookAuthor{AuthorStatus: commonModel.CommonEnabledStatusEnabled}); err != nil {
|
||||
t.Fatalf("validateBookAuthor enabled error = %v", err)
|
||||
}
|
||||
if err := validateBookAuthor(book.BookAuthor{AuthorStatus: commonModel.CommonEnabledStatusDisabled}); err != nil {
|
||||
t.Fatalf("validateBookAuthor disabled error = %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestApplyBookAuthorRelationDefaults(t *testing.T) {
|
||||
item := applyBookAuthorRelationDefaults(book.BookAuthorRelation{})
|
||||
if item.AuthorSort != 1 {
|
||||
|
||||
Reference in New Issue
Block a user