From 4f804958e5fd8e712cbaf5ebefbc903c86a28c90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sybren=20A=2E=20St=C3=BCvel?= Date: Sun, 4 Feb 2024 16:09:23 +0100 Subject: [PATCH] Manager: add unittest for eventbus topics The code was doing its work just fine, but I wanted to be sure. --- internal/manager/eventbus/topics_test.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 internal/manager/eventbus/topics_test.go diff --git a/internal/manager/eventbus/topics_test.go b/internal/manager/eventbus/topics_test.go new file mode 100644 index 00000000..5d262b62 --- /dev/null +++ b/internal/manager/eventbus/topics_test.go @@ -0,0 +1,14 @@ +package eventbus + +import ( + "testing" + + "github.com/stretchr/testify/assert" +) + +func TestParamterisedTopics(t *testing.T) { + uuid := "646f85f3-7166-40bd-9d43-d2b5baaeb42a" + assert.Equal(t, EventTopic("/jobs/646f85f3-7166-40bd-9d43-d2b5baaeb42a"), topicForJob(uuid)) + assert.Equal(t, EventTopic("/jobs/646f85f3-7166-40bd-9d43-d2b5baaeb42a/last-rendered"), topicForJobLastRendered(uuid)) + assert.Equal(t, EventTopic("/tasklog/646f85f3-7166-40bd-9d43-d2b5baaeb42a"), topicForTaskLog(uuid)) +}