Add the testing gubbins

This commit is contained in:
Micheal Wilkinson
2026-03-17 21:48:48 +00:00
parent 0d2cb5efd9
commit 21709fc91a
2 changed files with 10 additions and 0 deletions

View File

@@ -8,4 +8,5 @@ type NoteStore interface {
SaveNote(models.Note) (models.Note, error)
GetNoteByID(int) (models.Note, error)
GetAllNotes() ([]models.Note, error)
DeleteNoteByID(int) error
}

View File

@@ -46,3 +46,12 @@ func (m *mockNoteStore) getNoteAndIndexByID(id int) (models.Note, int, error) {
func (m *mockNoteStore) GetAllNotes() ([]models.Note, error) {
return m.Notes, nil
}
func (m *mockNoteStore) DeleteNoteByID(id int) error {
_, index, err := m.getNoteAndIndexByID(id)
if err != nil {
return err
}
m.Notes = append(m.Notes[:index], m.Notes[index+1:]...)
return nil
}