]> git.giacomolli.uk - onechat/blobdiff - daemon_message_test.go
Submit root events through the local socket
[onechat] / daemon_message_test.go
index dd3906b106d506b2e2b19835afdabab16d9514a6..cfb41c643908cb3ac80728d72e0526e0ea0acc32 100644 (file)
@@ -251,8 +251,21 @@ func TestNotificationBatchesKeepAcceptanceOrder(t *testing.T) {
 }
 
 func TestNotificationRecoversItsPreparedLogIDWithoutAnotherAppend(t *testing.T) {
-       for _, appended := range []bool{false, true} {
-               t.Run(fmt.Sprintf("log append completed %t", appended), func(t *testing.T) {
+       testCases := []struct {
+               name     string
+               appended bool
+       }{
+               {
+                       name: "recovers a saved ID before the log append",
+               },
+               {
+                       name:     "reuses the log entry after the append",
+                       appended: true,
+               },
+       }
+
+       for _, tc := range testCases {
+               t.Run(tc.name, func(t *testing.T) {
                        directory := t.TempDir()
                        server := newModelFake(t)
                        server.reply = func(w http.ResponseWriter, _ ModelFakeCall) {
@@ -267,7 +280,7 @@ func TestNotificationRecoversItsPreparedLogIDWithoutAnotherAppend(t *testing.T)
                        })
                        require.NoError(t, err)
 
-                       if appended {
+                       if tc.appended {
                                require.NoError(t, first.messages.Notifications(first.loops[0]))
                        } else {
                                id := 0