mirror of
https://github.com/lordmathis/lemma.git
synced 2025-11-05 23:44:22 +00:00
Implement session and system tests
This commit is contained in:
30
server/internal/db/testdb.go
Normal file
30
server/internal/db/testdb.go
Normal file
@@ -0,0 +1,30 @@
|
||||
//go:build test
|
||||
|
||||
package db
|
||||
|
||||
import (
|
||||
"database/sql"
|
||||
"novamd/internal/secrets"
|
||||
)
|
||||
|
||||
type TestDatabase interface {
|
||||
Database
|
||||
TestDB() *sql.DB
|
||||
}
|
||||
|
||||
func NewTestDB(dbPath string, secretsService secrets.Service) (TestDatabase, error) {
|
||||
db, err := Init(dbPath, secretsService)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &testDatabase{db.(*database)}, nil
|
||||
}
|
||||
|
||||
type testDatabase struct {
|
||||
*database
|
||||
}
|
||||
|
||||
func (td *testDatabase) TestDB() *sql.DB {
|
||||
return td.DB
|
||||
}
|
||||
Reference in New Issue
Block a user