Automatic Merge
Этот коммит содержится в:
Harshil Sharma
2026-05-25 15:54:05 +05:30
коммит произвёл GitHub
родитель c0ea57ac6c
Коммит 36ac3a43b1
28 изменённых файлов: 602 добавлений и 31 удалений

Просмотреть файл

@@ -8,6 +8,7 @@ import (
"net/http"
"testing"
"github.com/mattermost/mattermost/server/v8/channels/utils"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/mock"
"github.com/stretchr/testify/require"
@@ -1057,28 +1058,10 @@ func TestAddChannelsToPolicy(t *testing.T) {
validChannelIDs := []string{model.NewId(), model.NewId()}
invalidChannelIDs := []string{"invalid_channel_id"}
// Custom function to compare slices regardless of order
unorderedSlicesEqual := func(a, b []string) bool {
if len(a) != len(b) {
return false
}
counts := make(map[string]int)
for _, item := range a {
counts[item]++
}
for _, item := range b {
counts[item]--
if counts[item] < 0 {
return false
}
}
return true
}
// Custom matcher for unordered slice comparison
unorderedSliceMatcher := func(expected []string) func(actual []string) bool {
return func(actual []string) bool {
return unorderedSlicesEqual(expected, actual)
return utils.SliceEqualUnordered(expected, actual)
}
}