/
archaron
/
go-yubiserv
Обзор
Документация
Войти
/
archaron
/
go-yubiserv
Код
Запросы
0
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
modules/sqlitestorage/module_test.go
65 строк
1 KB
Alexander Tischenko
chore: linter wars
29 май 2026, 17:53
Не верифицирован
29 май 2026, 17:53
99f0d05
Код
Авторство
О чём код?
package sqlitestorage //nolint:testpackage import ( "context" "testing" "github.com/jmoiron/sqlx" "github.com/spf13/viper" "github.com/stretchr/testify/require" "go.uber.org/zap/zaptest" ) func TestModule(t *testing.T) { t.Parallel() t.Run("module initialization", func(t *testing.T) { t.Parallel() require.NotNil(t, Module) require.Len(t, Module, 1, "must be exactly one module") require.NotNil(t, Module[0].Constructor) }) } func TestTestNewService(t *testing.T) { t.Parallel() t.Run("with custom getter", func(t *testing.T) { t.Parallel() logger := zaptest.NewLogger(t) mockDB := &sqlx.DB{} customGetter := func(context.Context, string) (*Key, error) { return &Key{}, nil } svc := TestNewService(logger, customGetter, mockDB) require.NotNil(t, svc) require.NotNil(t, svc.getKeyFunc) }) } func TestNewServiceInit(t *testing.T) { t.Parallel() t.Run("service initialization", func(t *testing.T) { t.Parallel() // Настраиваем Viper для теста v := viper.New() v.Set("sqlite.dbpath", "test.db") logger := zaptest.NewLogger(t) params := serviceParams{ Logger: logger, Config: v, } out := newService(params) require.NotNil(t, out.Service) require.NotNil(t, out.Storage) }) }