alert_test.go 978 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. package handler
  2. import (
  3. "bytes"
  4. "log/slog"
  5. "testing"
  6. "github.com/mk6i/retro-aim-server/wire"
  7. "github.com/stretchr/testify/assert"
  8. )
  9. func TestAlertHandler_NotifyCapabilities(t *testing.T) {
  10. input := wire.SNACMessage{
  11. Frame: wire.SNACFrame{
  12. FoodGroup: wire.Alert,
  13. SubGroup: wire.AlertNotifyCapabilities,
  14. },
  15. Body: wire.SNACFrame{},
  16. }
  17. h := NewAlertHandler(slog.Default())
  18. buf := &bytes.Buffer{}
  19. assert.NoError(t, wire.MarshalBE(input.Body, buf))
  20. assert.NoError(t, h.NotifyCapabilities(nil, nil, input.Frame, buf, nil))
  21. }
  22. func TestAlertHandler_NotifyDisplayCapabilities(t *testing.T) {
  23. input := wire.SNACMessage{
  24. Frame: wire.SNACFrame{
  25. FoodGroup: wire.Alert,
  26. SubGroup: wire.AlertNotifyDisplayCapabilities,
  27. },
  28. Body: wire.SNACFrame{},
  29. }
  30. h := NewAlertHandler(slog.Default())
  31. buf := &bytes.Buffer{}
  32. assert.NoError(t, wire.MarshalBE(input.Body, buf))
  33. assert.NoError(t, h.NotifyDisplayCapabilities(nil, nil, input.Frame, buf, nil))
  34. }