fix: set "DB_FILE" environment variable in tests

This commit adds a line to set the "DB_FILE" environment variable in tests. This ensures that tests are always using "test.db" for database related operations, aligning testing environment accurately which guarantees consistent results.
This commit is contained in:
Florian Sylvain
2023-08-13 21:41:04 +02:00
parent a785483220
commit 60e25cea2f
+1
View File
@@ -31,6 +31,7 @@ func StartServerIfNotAlready() {
return
}
_ = os.Remove("test.db")
_ = os.Setenv("DB_FILE", "test.db")
go func(url *string) {
router := server.InitServer()
*url = "http://localhost:" + os.Getenv("PORT") + "/v1"