Test Note Retrieval
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
package repository_test
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"git.hrafn.xyz/aether/notes/internal/models"
|
||||
)
|
||||
|
||||
@@ -13,3 +15,12 @@ func (m *mockNoteStore) SaveNote(note models.Note) (models.Note, error) {
|
||||
m.Notes = append(m.Notes, note)
|
||||
return note, nil
|
||||
}
|
||||
|
||||
func (m *mockNoteStore) GetNoteByID(id int) (models.Note, error) {
|
||||
for _, note := range m.Notes {
|
||||
if note.ID == id {
|
||||
return note, nil
|
||||
}
|
||||
}
|
||||
return models.Note{}, fmt.Errorf("note with ID %d not found", id)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user