X-Git-Url: https://git.giacomolli.uk/onechat/blobdiff_plain/a5c83e92d7feea2e104b5515043a76c8c4c56c60..959c24478e2c3a596a81cca359fd784c897f46a2:/memory_test.go?ds=sidebyside diff --git a/memory_test.go b/memory_test.go index 6713f6d..d3fa612 100644 --- a/memory_test.go +++ b/memory_test.go @@ -143,6 +143,7 @@ func TestMemoryRunsAtMostEightBuilds(t *testing.T) { slices.SortFunc(running, func(a, b NodeKey) int { return a.index - b.index }) + require.Equal(t, []NodeKey{{0, 0}, {0, 1}, {0, 2}, {0, 3}, {0, 4}, {0, 5}, {0, 6}, {0, 7}}, running) require.Eventually(t, func() bool { @@ -482,21 +483,22 @@ func TestQueuedAppendRefusesAnInvalidReceipt(t *testing.T) { cause string }{ { - name: "receipt points to different text", + name: "refuses when receipt points to different text", id: 0, cause: "does not match", }, { - name: "receipt skips a log position", + name: "refuses when receipt skips a log position", id: 2, cause: "beyond the log", }, { - name: "receipt has a negative position", + name: "refuses when receipt has a negative position", id: -1, cause: "read queued message", }, } + for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { _, err := memory.AppendOnce("user", "Other text.", &tc.id, func(int) error {