add test for the wall app
Signed-off-by: GnomeZworc <nicolas.boufidjeline@g3e.fr>
This commit is contained in:
parent
c4776d81dd
commit
9e287e4e6a
15 changed files with 3022 additions and 1 deletions
36
internal/store/testhelper_test.go
Normal file
36
internal/store/testhelper_test.go
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
package store_test
|
||||
|
||||
import (
|
||||
"context"
|
||||
"database/sql"
|
||||
"testing"
|
||||
|
||||
"github.com/syonad/clonepack/config"
|
||||
"github.com/syonad/clonepack/internal/store"
|
||||
)
|
||||
|
||||
func newTestDB(t *testing.T) *sql.DB {
|
||||
t.Helper()
|
||||
db, err := store.Open(config.DBConfig{Path: ":memory:"})
|
||||
if err != nil {
|
||||
t.Fatalf("open db: %v", err)
|
||||
}
|
||||
t.Cleanup(func() { db.Close() })
|
||||
return db
|
||||
}
|
||||
|
||||
// insertTestRepo crée un repo minimal et retourne son ID.
|
||||
func insertTestRepo(t *testing.T, db *sql.DB) int64 {
|
||||
t.Helper()
|
||||
s := store.NewRepoStore(db)
|
||||
id, err := s.CreateRepo(context.Background(), &store.Repo{
|
||||
Name: "test-repo",
|
||||
Type: "rpm",
|
||||
SourceURL: "https://example.com",
|
||||
SyncMode: "auto",
|
||||
})
|
||||
if err != nil {
|
||||
t.Fatalf("insertTestRepo: %v", err)
|
||||
}
|
||||
return id
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue