refac: debt on role backend

This commit is contained in:
Florian Sylvain committed 2026-10-26 23:34:35 +01:00
1 parent de142f6c5f
commit a043f7f41a
130 files changed
+3591 -512

No files matched your search

+4 -1
View File
@@ -23,6 +23,9 @@ type seoAlwaysRacingArticleRepo struct {
func (r *seoAlwaysRacingArticleRepo) Create(a article.Article) (article.Article, error) {
r.createCalls++
if r.createCalls > 100 {
return article.Article{}, errors.New("create budget exceeded")
}
return article.Article{}, article.ErrSlugTaken
}
@@ -69,7 +72,7 @@ func TestSeoDataCleanerSlugRaces(t *testing.T) {
racing := &seoAlwaysRacingArticleRepo{mockArticleRepo: e.articles}
create := useCases.NewCreateArticleUseCase(racing, &fakeBodyRenderer{}, e.audit.recorder, e.sites, e.authors)
_, err := create.CreateArticle(t.Context(), useCases.CreateArticleCommand{Title: "Racing", Body: "x"})
_, err := create.CreateArticle(t.Context(), useCases.CreateArticleCommand{Caller: ownerCaller(1), Title: "Racing", Body: "x"})
if !errors.Is(err, article.ErrSlugTaken) || racing.createCalls != 5 {
t.Errorf("err %v after %d attempts", err, racing.createCalls)