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
@@ -74,3 +74,28 @@ func TestMoveStoryRelocksUntilTheSiteSetIsStable(t *testing.T) {
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
func TestDeleteStoryRelocksUntilTheSiteSetIsStable(t *testing.T) {
|
||||
t.Run("A set that never settles is refused as lock contention after the last round", func(t *testing.T) {
|
||||
w := newStoryWorld(t)
|
||||
listing := &shiftingStoryRepo{mockArticleRepo: w.articles, shiftFrom: 1}
|
||||
listing.shift = func() {
|
||||
shifted := w.articles.articles[13]
|
||||
shifted.SiteID = 100 + uint32(listing.listings)
|
||||
w.articles.articles[13] = shifted
|
||||
}
|
||||
deleter := useCases.NewDeleteStoryUseCase(repositoriesTransactor{transaction.Repositories{Articles: listing, Sites: w.sites}}, listing, discardRecorder)
|
||||
|
||||
err := deleter.DeleteStory(context.Background(), useCases.DeleteStoryCommand{StoryID: storyStory, Caller: ownerCaller(storyOwner)})
|
||||
|
||||
if !errors.Is(err, transaction.ErrLockContention) {
|
||||
t.Errorf("expected lock contention, got %v", err)
|
||||
}
|
||||
if listing.listings != 6 {
|
||||
t.Errorf("expected five lock rounds plus the refusal lookup, got %d listings", listing.listings)
|
||||
}
|
||||
if _, kept := w.articles.articles[13]; !kept {
|
||||
t.Error("nothing may be deleted")
|
||||
}
|
||||
})
|
||||
}
|
||||
Reference in new issue
Block a user