Implement session and system tests

This commit is contained in:
2024-11-25 21:44:43 +01:00
parent 9ac047d440
commit 32bd202d6f
9 changed files with 520 additions and 10 deletions

View 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
}