29 lines
612 B
Go
29 lines
612 B
Go
|
|
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)
|
||
|
|
}
|