diff --git a/internal/repository/notes_test.go b/internal/repository/notes_test.go index 7954a89..ce7b61c 100644 --- a/internal/repository/notes_test.go +++ b/internal/repository/notes_test.go @@ -47,28 +47,29 @@ func TestCreateNote(t *testing.T) { } repo := repository.NewNoteRepository(&mockNoteStore{}) for _, tc := range testCases { - - synctest.Test(t, func(t *testing.T) { - note, err := repo.CreateNote(tc.content) - if tc.expectedError { - if err == nil { - t.Errorf("expected an error but got none") + t.Run(tc.name, func(t *testing.T) { + synctest.Test(t, func(t *testing.T) { + note, err := repo.CreateNote(tc.content) + if tc.expectedError { + if err == nil { + t.Errorf("expected an error but got none") } - } else { - if err != nil { - t.Errorf("unexpected error: %v", err) + } else { + if err != nil { + t.Errorf("unexpected error: %v", err) + } } - } - if note.Content != tc.expectedNote.Content { - t.Errorf("expected content %q but got %q", tc.expectedNote.Content, note.Content) - } - if note.ID != tc.expectedNote.ID { - t.Errorf("expected ID %d but got %d", tc.expectedNote.ID, note.ID) - } - if !note.LastUpdate.Equal(tc.expectedNote.LastUpdate) { - t.Errorf("expected LastUpdate %v but got %v", tc.expectedNote.LastUpdate, note.LastUpdate) - } - fmt.Printf("Test case '%s' passed.\n", tc.name) + if note.Content != tc.expectedNote.Content { + t.Errorf("expected content %q but got %q", tc.expectedNote.Content, note.Content) + } + if note.ID != tc.expectedNote.ID { + t.Errorf("expected ID %d but got %d", tc.expectedNote.ID, note.ID) + } + if !note.LastUpdate.Equal(tc.expectedNote.LastUpdate) { + t.Errorf("expected LastUpdate %v but got %v", tc.expectedNote.LastUpdate, note.LastUpdate) + } + fmt.Printf("Test case '%s' passed.\n", tc.name) + }) }) } }