Test Note Retrieval

This commit is contained in:
Micheal Wilkinson
2026-03-17 21:23:10 +00:00
parent a3aa962d39
commit 087b21d5dd
4 changed files with 82 additions and 0 deletions

View File

@@ -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)
}