From 9073adf62f2fa78190c8296c5f6f6c9fb1963063 Mon Sep 17 00:00:00 2001
From: xengineering <me@xengineering.eu>
Date: Wed, 8 May 2024 21:20:39 +0200
Subject: Fix unit tests

---
 model/recipe_test.go | 19 ++++++++++++++++---
 1 file changed, 16 insertions(+), 3 deletions(-)

(limited to 'model/recipe_test.go')

diff --git a/model/recipe_test.go b/model/recipe_test.go
index 508cf53..7b6c14c 100644
--- a/model/recipe_test.go
+++ b/model/recipe_test.go
@@ -3,13 +3,26 @@ package model
 import (
 	"reflect"
 	"testing"
+	"path/filepath"
+	"os"
+	"fmt"
 )
 
 func TestRecipeCrud(t *testing.T) {
-	InitStorage()
-	defer RemoveStorage()
+	storagePath, err := os.MkdirTemp("", "ceres")
+	if err != nil {
+		fmt.Println("Error creating temporary directory:", err)
+		return
+	}
+	t.Logf("Storage path: %v\n", storagePath)
+	defer os.RemoveAll(storagePath)
+
+	storage := NewStorage(storagePath)
+	if !storage.Exists() {
+		storage.Create()
+	}
 
-	InitDatabase()
+	InitDatabase(filepath.Join(storage.Path, "ceres.sqlite3"))
 	defer CloseDatabase()
 
 	tx, err := NewTx()
-- 
cgit v1.2.3-70-g09d2