Remember to wrap the synctest in a run for the name of the thing
This commit is contained in:
@@ -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)
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user