Added NoteStore interface, mock and repository with Create method

This commit is contained in:
Micheal Wilkinson
2026-03-17 21:13:11 +00:00
parent c05603d624
commit 2f035ee485
6 changed files with 42 additions and 41 deletions

View File

@@ -4,8 +4,8 @@ import (
"testing"
"testing/synctest"
"time"
"fmt"
"time"
"git.hrafn.xyz/aether/notes/internal/models"
"git.hrafn.xyz/aether/notes/internal/repository"
@@ -71,4 +71,4 @@ func TestCreateNote(t *testing.T) {
fmt.Printf("Test case '%s' passed.\n", tc.name)
})
}
}
}

View File

@@ -3,6 +3,7 @@ package repository
import (
"git.hrafn.xyz/aether/notes/internal/models"
)
type NoteStore interface {
SaveNote(models.Note) (models.Note, error)
}

View File

@@ -5,11 +5,11 @@ import (
)
type mockNoteStore struct {
notes []models.Note
Notes []models.Note
}
func (m *mockNoteStore) SaveNote(note models.Note) (models.Note, error) {
note.ID = len(m.notes) + 1
m.notes = append(m.notes, note)
note.ID = len(m.Notes) + 1
m.Notes = append(m.Notes, note)
return note, nil
}