refac: migration crash, real-database tests, site deleted during create, ruels out of the repo, lists

This commit is contained in:
Florian Sylvain committed 2026-11-03 05:06:04 +01:00
1 parent 680b9a1308
commit 9d284e65a9
62 files changed
+1858 -987

No files matched your search

+11
View File
@@ -81,6 +81,17 @@ func TestCreateArticleStartingLanguage(t *testing.T) {
}
})
t.Run("A site deleted after its lookup refuses the creation with a specific error", func(t *testing.T) {
create, transactor, articles := newCreateLanguageFixture(map[uint32]string{createLanguageSiteID: confirmedDefaultTag})
transactor.languages.removed = map[uint32]bool{createLanguageSiteID: true}
_, err := create.CreateArticle(context.Background(), createLanguageCommand())
if !errors.Is(err, article.ErrTargetSiteDeleted) || errors.Is(err, site.ErrSiteNotFound) || articles.createCalled {
t.Errorf("expected ErrTargetSiteDeleted without a create, got %v", err)
}
})
t.Run("The command site decides the site and the language lock", func(t *testing.T) {
create, transactor, articles := newCreateLanguageFixture(map[uint32]string{createLanguageSiteID: confirmedDefaultTag, createLanguageOtherSiteID: "de"})
create = useCases.NewCreateArticleUseCase(transactor, &fakeBodyRenderer{}, discardRecorder, createLanguageSites(), plainAuthors())