veza/veza-backend-api/internal/services/gear_warranty_notifier_test.go

29 lines
612 B
Go
Raw Normal View History

package services
import (
"testing"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"go.uber.org/zap"
"gorm.io/driver/sqlite"
"gorm.io/gorm"
"veza-backend-api/internal/models"
)
func setupGearWarrantyDB(t *testing.T) *gorm.DB {
db, err := gorm.Open(sqlite.Open(":memory:"), &gorm.Config{})
require.NoError(t, err)
require.NoError(t, db.AutoMigrate(&models.GearItem{}))
return db
}
func TestNewGearWarrantyNotifier(t *testing.T) {
db := setupGearWarrantyDB(t)
logger := zap.NewNop()
notifier := NewGearWarrantyNotifier(db, nil, logger)
assert.NotNil(t, notifier)
}