From 485f49c2323a95297c8b5ae5f44320825d66ae82 Mon Sep 17 00:00:00 2001 From: Alexander Neonxp Kiryukhin Date: Sun, 22 Mar 2026 16:13:20 +0300 Subject: new version --- bus_test.go | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'bus_test.go') diff --git a/bus_test.go b/bus_test.go index d7d5a08..bfead50 100644 --- a/bus_test.go +++ b/bus_test.go @@ -15,12 +15,11 @@ func (e testEvent) Event() string { return e.name } -func TestBusFire(t *testing.T) { +func TestBusPublish(t *testing.T) { bus := eventbus.New() // Подписываемся на событие - ch := bus.Subscribe("test.event") - defer bus.Unsubscribe(ch) + ch := bus.Subscribe(t.Context(), "test.event") // Создаем канал для проверки получения события received := make(chan bool, 1) @@ -38,7 +37,7 @@ func TestBusFire(t *testing.T) { }() // Отправляем событие - bus.Fire(testEvent{name: "test.event"}) + bus.Publish(testEvent{name: "test.event"}) // Проверяем получение события select { @@ -51,12 +50,12 @@ func TestBusFire(t *testing.T) { } } -func TestBusFireWithWildcard(t *testing.T) { +func TestBusPublishWithWildcard(t *testing.T) { bus := eventbus.New(eventbus.NameSeparator("/"), eventbus.Wildcard("#"), eventbus.Capacity(32)) defer bus.Close() // Подписываемся на wildcard событие - ch := bus.Subscribe("/test/#") + ch := bus.Subscribe(t.Context(), "/test/#") // Создаем канал для проверки получения события received := make(chan bool, 1) @@ -74,7 +73,7 @@ func TestBusFireWithWildcard(t *testing.T) { }() // Отправляем событие - bus.Fire(testEvent{name: "/test/event"}) + bus.Publish(testEvent{name: "/test/event"}) // Проверяем получение события select { -- cgit v1.2.3