mirror of https://github.com/usememos/memos
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
501 B
Go
26 lines
501 B
Go
package teststore
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
"testing"
|
|
|
|
"github.com/usememos/memos/store"
|
|
"github.com/usememos/memos/store/db"
|
|
"github.com/usememos/memos/test"
|
|
|
|
// sqlite driver.
|
|
_ "modernc.org/sqlite"
|
|
)
|
|
|
|
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
|
|
}
|