mirror of
https://github.com/usememos/memos.git
synced 2025-02-19 04:40:40 +01:00
26 lines
511 B
Go
26 lines
511 B
Go
package teststore
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
"testing"
|
|
|
|
"github.com/usememos/memos/store"
|
|
"github.com/usememos/memos/store/db"
|
|
"github.com/usememos/memos/test"
|
|
|
|
// sqlite3 driver.
|
|
_ "github.com/mattn/go-sqlite3"
|
|
)
|
|
|
|
func NewTestingStore(ctx context.Context, t *testing.T) *store.Store {
|
|
profile := test.GetTestingProfile(t)
|
|
db := db.NewDB(profile)
|
|
if err := db.Open(ctx); err != nil {
|
|
fmt.Printf("failed to open db, error: %+v\n", err)
|
|
}
|
|
|
|
store := store.New(db.DBInstance, profile)
|
|
return store
|
|
}
|