refac: repository updates, image attachment and deletes report the domain not-found error for an unknown id, the same for articles, users and images, and the test fakes stop returning GORM errors
This commit is contained in:
1 parent
4278d96882
commit
6a2ca07b66
14 files changed
+553
-66
No files matched your search
@@ -0,0 +1,30 @@
|
||||
package test
|
||||
|
||||
import (
|
||||
domainArticle "RenewCMS/internal/domain/article"
|
||||
domainUser "RenewCMS/internal/domain/user"
|
||||
"errors"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestDeletingTheSeededArticleActuallyRemovesTheRow(t *testing.T) {
|
||||
repo := newSeededArticleRepository(t)
|
||||
|
||||
if err := repo.Delete(1); err != nil {
|
||||
t.Fatalf("expected Delete(1) to succeed, got %v", err)
|
||||
}
|
||||
if _, err := repo.Get(1); !errors.Is(err, domainArticle.ErrArticleNotFound) {
|
||||
t.Errorf("expected article.ErrArticleNotFound after delete, got %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestDeletingTheSeededUserActuallyRemovesTheRow(t *testing.T) {
|
||||
repo := newSeededUserRepository(t)
|
||||
|
||||
if err := repo.Delete(1); err != nil {
|
||||
t.Fatalf("expected Delete(1) to succeed, got %v", err)
|
||||
}
|
||||
if _, err := repo.Get(1); !errors.Is(err, domainUser.ErrUserNotFound) {
|
||||
t.Errorf("expected user.ErrUserNotFound after delete, got %v", err)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user