mirror of
https://github.com/hanzoai/team.git
synced 2026-09-30 01:57:35 +00:00
The server module named github.com/hanzoai/team/server/v8 — a path that resolves to the retired workspace's repository, not this one — while server/public still published github.com/mattermost/mattermost/server/public. Both are github.com/hanzoteam/server/... now, which is where this code actually lives. That second half is what made the binary unbootable. Upstream's public path stayed claimed by upstream, mattermost-plugin-ai imported it, and the build linked public/model twice; public/plugin's gob.Register then ran twice under one name and panicked at init, before main. Reverting the rename traded the brand for a working binary. Rebranding the plugin alongside it needs no such trade: the agents fork is github.com/hanzoteam/agents/v2 against our public module, so no module named mattermost/mattermost is in the graph at all. Measured: `go list -deps ./cmd/mattermost` names exactly one public/model, and it is ours.
95 lines
2.0 KiB
Go
95 lines
2.0 KiB
Go
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
|
// See LICENSE.txt for license information.
|
|
|
|
package api4
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/hanzoteam/server/server/v8/channels/utils"
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestSameFileIDs(t *testing.T) {
|
|
tests := []struct {
|
|
name string
|
|
a []string
|
|
b []string
|
|
expected bool
|
|
}{
|
|
{
|
|
name: "both empty",
|
|
a: []string{},
|
|
b: []string{},
|
|
expected: true,
|
|
},
|
|
{
|
|
name: "both nil",
|
|
a: nil,
|
|
b: nil,
|
|
expected: true,
|
|
},
|
|
{
|
|
name: "same files same order",
|
|
a: []string{"file1", "file2", "file3"},
|
|
b: []string{"file1", "file2", "file3"},
|
|
expected: true,
|
|
},
|
|
{
|
|
name: "same files different order",
|
|
a: []string{"file3", "file1", "file2"},
|
|
b: []string{"file1", "file2", "file3"},
|
|
expected: true,
|
|
},
|
|
{
|
|
name: "one file added",
|
|
a: []string{"file1", "file2", "file3"},
|
|
b: []string{"file1", "file2"},
|
|
expected: false,
|
|
},
|
|
{
|
|
name: "one file removed",
|
|
a: []string{"file1"},
|
|
b: []string{"file1", "file2"},
|
|
expected: false,
|
|
},
|
|
{
|
|
name: "different files same length",
|
|
a: []string{"file1", "file2"},
|
|
b: []string{"file1", "file3"},
|
|
expected: false,
|
|
},
|
|
{
|
|
name: "duplicate IDs in a",
|
|
a: []string{"file1", "file1"},
|
|
b: []string{"file1", "file2"},
|
|
expected: false,
|
|
},
|
|
{
|
|
name: "duplicate IDs same in both",
|
|
a: []string{"file1", "file1"},
|
|
b: []string{"file1", "file1"},
|
|
expected: true,
|
|
},
|
|
{
|
|
name: "empty vs non-empty",
|
|
a: []string{},
|
|
b: []string{"file1"},
|
|
expected: false,
|
|
},
|
|
{
|
|
name: "nil vs non-empty",
|
|
a: nil,
|
|
b: []string{"file1"},
|
|
expected: false,
|
|
},
|
|
}
|
|
|
|
for _, tc := range tests {
|
|
t.Run(tc.name, func(t *testing.T) {
|
|
result := utils.SliceEqualUnordered(tc.a, tc.b)
|
|
assert.Equal(t, tc.expected, result)
|
|
})
|
|
}
|
|
}
|