From 889cb5d997004adf0f37e3c14c5792defef0b6dc Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Tue, 4 Jun 2024 20:13:11 +0300 Subject: use subtests --- internal/server/repository/repository_test.go | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'internal/server') diff --git a/internal/server/repository/repository_test.go b/internal/server/repository/repository_test.go index 3868870..6581a3a 100644 --- a/internal/server/repository/repository_test.go +++ b/internal/server/repository/repository_test.go @@ -18,16 +18,16 @@ func TestRepositoryPutGet(t *testing.T) { entries := []types.Entry{entry1, entry2} for _, entry := range entries { - _ = repo.put(entry) - entryGot, ok := repo.Get(entry.ID) - if !ok { - t.Errorf("could not find entry with id %s in repo", entry.ID) - return - } - if !entryGot.Equals(entry) { - t.Error("expected to get", entry, "but got", entryGot) - return - } + t.Run(entry.ID, func(t *testing.T) { + _ = repo.put(entry) + entryGot, ok := repo.Get(entry.ID) + if !ok { + t.Errorf("could not find entry with id %s in repo", entry.ID) + } + if !entryGot.Equals(entry) { + t.Error("expected to get", entry, "but got", entryGot) + } + }) } } @@ -47,7 +47,7 @@ func makeAnEntry(fs fs) (types.Entry, error) { func makeAnotherEntry(fs fs) (types.Entry, error) { entry := ` { - "Body": "Body text here", + "Body": "Another text here", "Shared": [ { "Name": "Foo", "Is": true }, { "Name": "Bar", "Is": true }, -- cgit v1.2.3