-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathmessaging_test.go
More file actions
31 lines (27 loc) · 987 Bytes
/
messaging_test.go
File metadata and controls
31 lines (27 loc) · 987 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// Copyright The Linux Foundation and each contributor to LFX.
// SPDX-License-Identifier: MIT
package constants_test
import (
"testing"
"github.com/linuxfoundation/lfx-v2-indexer-service/pkg/constants"
"github.com/stretchr/testify/assert"
)
func TestBuildEventSubject(t *testing.T) {
tests := []struct {
objectType string
action constants.MessageAction
expected string
}{
{constants.ObjectTypeProject, constants.ActionCreated, "lfx.project.created"},
{constants.ObjectTypeProject, constants.ActionUpdated, "lfx.project.updated"},
{constants.ObjectTypeProject, constants.ActionDeleted, "lfx.project.deleted"},
{constants.ObjectTypeCommittee, constants.ActionCreated, "lfx.committee.created"},
{constants.ObjectTypeMeeting, constants.ActionDeleted, "lfx.meeting.deleted"},
}
for _, tt := range tests {
t.Run(tt.expected, func(t *testing.T) {
got := constants.BuildEventSubject(tt.objectType, tt.action)
assert.Equal(t, tt.expected, got)
})
}
}