refac: missing mutation tests, spa specs, checks shown to pass, touch targets, catalogue entry, production code
This commit is contained in:
1 parent
7c15206170
commit
3e02e14da4
48 files changed
+2173
-83
No files matched your search
@@ -121,6 +121,38 @@ func TestArticleCreateSiteHTTP(t *testing.T) {
|
||||
}
|
||||
})
|
||||
|
||||
t.Run("Without a site the article is created on the default site, which the activity names", func(t *testing.T) {
|
||||
for _, body := range []string{`{"title":"Plain"}`, `{"title":"Plain","site":null}`} {
|
||||
t.Run(body, func(t *testing.T) {
|
||||
w := newCreateSiteWorld(t)
|
||||
if _, err := w.sites.SetDefault(storyAtelier); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
created := createdTranslation(t, w, w.send(storyWriter, http.MethodPost, createSitePath, body))
|
||||
|
||||
if created.SiteID != storyAtelier || created.Lang != "fr" {
|
||||
t.Errorf("created on site %d in %q, the default Atelier in fr expected", created.SiteID, created.Lang)
|
||||
}
|
||||
events := w.eventsOf(audit.ActionArticleCreate)
|
||||
if len(events) != 1 || events[0].Outcome != audit.OutcomeSuccess || events[0].Params[audit.ParamSite] != "atelier" {
|
||||
t.Errorf("one article.create naming the default site expected: %+v", events)
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
t.Run("An unknown site key records the plain reason That site does not exist.", func(t *testing.T) {
|
||||
w := newCreateSiteWorld(t)
|
||||
|
||||
w.send(storyWriter, http.MethodPost, createSitePath, `{"title":"Plain","site":"missing"}`).expect(t, http.StatusNotFound, apperr.SiteNotFoundErrorMessage)
|
||||
|
||||
events := w.eventsOf(audit.ActionArticleCreate)
|
||||
if len(events) != 1 || events[0].FailureReason == nil || *events[0].FailureReason != "That site does not exist." {
|
||||
t.Fatalf("one failed article.create with the site reason expected: %+v", events)
|
||||
}
|
||||
})
|
||||
|
||||
t.Run("The language rules are those of the chosen site", func(t *testing.T) {
|
||||
w := newCreateSiteWorld(t)
|
||||
|
||||
|
||||
Reference in new issue
Block a user