Files
worker/app/models/telegram_bot_test.go
Gleb Tv 2c7a0236da feat: publish standalone worker
Separate worker packaging and service lifecycle from the control plane.
2026-07-13 17:55:14 +03:00

25 строки
571 B
Go

package models_test
import (
"testing"
"time"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"rsgit.ru/rsmon/rsmon/app/models"
)
func TestTelegramBotCurrentStatusMarksStaleOffline(t *testing.T) {
models.Drop()
models.Migrate()
seen := time.Now().Add(-3 * time.Minute)
status := models.TelegramBotStatus{Name: models.TelegramBotStatusMain, Online: true, LastSeen: &seen}
require.NoError(t, models.DB().Create(&status).Error)
got, err := models.TelegramBotCurrentStatus()
require.NoError(t, err)
assert.False(t, got.Online)
}