Add the testing gubbins
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user