mirror of
https://github.com/aykhans/slash-e.git
synced 2025-07-07 13:42:34 +00:00
feat: add user store tests
This commit is contained in:
25
test/store/store.go
Normal file
25
test/store/store.go
Normal file
@ -0,0 +1,25 @@
|
||||
package teststore
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
"github.com/boojack/shortify/store"
|
||||
"github.com/boojack/shortify/store/db"
|
||||
test "github.com/boojack/shortify/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
|
||||
}
|
Reference in New Issue
Block a user