From 24e77fe48f88d91c5e1ee4aac3473f750c08272b Mon Sep 17 00:00:00 2001 From: mo khan Date: Fri, 13 Jun 2025 15:07:08 -0600 Subject: test: add a simple test for the All() method --- app/db/in_memory_repository_test.go | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/app/db/in_memory_repository_test.go b/app/db/in_memory_repository_test.go index 9c44fa7..cfbab41 100644 --- a/app/db/in_memory_repository_test.go +++ b/app/db/in_memory_repository_test.go @@ -98,18 +98,13 @@ func TestInMemoryRepository(t *testing.T) { Reason: "because", })) - t.Run("prevents unintended modifications", func(t *testing.T) { + t.Run("returns all the items", func(t *testing.T) { items := repository.All(t.Context()) - require.Equal(t, 1, len(items)) - - sparkle := items[0] - sparkle.Reason = "haha" - - assert.Equal(t, "because", repository.All(t.Context())[0].Reason) - }) - t.Run("prevents race conditions", func(t *testing.T) { - t.Skip() + require.NotNil(t, items) + require.Equal(t, 1, len(items)) + assert.Equal(t, "@tanuki", items[0].Sparklee) + assert.Equal(t, "because", items[0].Reason) }) }) -- cgit v1.2.3