This commit is contained in:
Maxime Duchene-Savard 2025-04-03 09:09:23 -04:00
parent 8271f37af6
commit 0a5fc21b69
3 changed files with 6 additions and 5 deletions

2
.gitignore vendored
View File

@ -1,2 +1,4 @@
/frontend/node_modules/ /frontend/node_modules/
/frontend/dist/ /frontend/dist/
clortho.db
clortho

View File

@ -16,19 +16,18 @@ import (
func TestMain(m *testing.M) { func TestMain(m *testing.M) {
// Set up test database file // Set up test database file
os.Setenv("CLORTHO_DB_FILE", "test_clortho.db") os.Setenv("CLORTHO_DB_FILE", "clortho_test.db")
// Global setup // Global setup
fmt.Println("Setting up resources...") fmt.Println("Setting up resources...")
db.InitDb() db.InitDb()
defer db.ResetDb()
exitCode := m.Run() // Run all tests exitCode := m.Run() // Run all tests
// Global teardown // Global teardown
fmt.Println("Cleaning up resources...") fmt.Println("Cleaning up resources...")
db.ResetDb()
os.Exit(exitCode) os.Exit(exitCode)
} }

View File

@ -8,8 +8,8 @@ import (
// Test to check if all expected tables exist in the database // Test to check if all expected tables exist in the database
func TestTablesExist(t *testing.T) { func TestTablesExist(t *testing.T) {
// Set up test database file // Set up test database file
os.Setenv("CLORTHO_DB_FILE", "test_clortho.db") os.Setenv("CLORTHO_DB_FILE", "clortho_test.db")
defer os.Remove("test_clortho.db") // Cleanup after test defer os.Remove("clortho_test.db") // Cleanup after test
// Initialize database // Initialize database
err := InitDb() err := InitDb()