fix: sort companies before comparing since map-iteration is not stable

This commit is contained in:
2020-04-12 20:46:18 +02:00
parent c36ff4fa98
commit eb147039b6
+2 -1
View File
@@ -5,6 +5,7 @@ import (
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"net/http" "net/http"
"net/http/httptest" "net/http/httptest"
"sort"
"testing" "testing"
) )
@@ -64,7 +65,7 @@ func TestPrivilegeHandler_Process_UserAdded_And_UserRemoved(t *testing.T) {
companies := handler.CompaniesByUser("jim@example.org", func(privileges CompanyPrivileges) bool { companies := handler.CompaniesByUser("jim@example.org", func(privileges CompanyPrivileges) bool {
return true return true
}) })
sort.Strings(companies)
assert.Equal(t, []string{"abc-123", "abc-456"}, companies) assert.Equal(t, []string{"abc-123", "abc-456"}, companies)
result = handler.Process(&UserRemoved{ result = handler.Process(&UserRemoved{