2019-01-24 16:26:36 +00:00
|
|
|
// Copyright (C) 2019 Storj Labs, Inc.
|
2018-11-20 14:50:47 +00:00
|
|
|
// See LICENSE for copying information.
|
|
|
|
|
|
|
|
package satellitedb
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/stretchr/testify/assert"
|
2018-11-29 18:39:27 +00:00
|
|
|
|
2019-01-15 13:03:24 +00:00
|
|
|
"storj.io/storj/satellite/console"
|
2018-11-20 14:50:47 +00:00
|
|
|
)
|
|
|
|
|
2018-12-28 12:07:35 +00:00
|
|
|
func TestSanitizedOrderColumnName(t *testing.T) {
|
|
|
|
testCases := [...]struct {
|
|
|
|
orderNumber int8
|
|
|
|
orderColumn string
|
|
|
|
}{
|
2019-03-27 12:33:32 +00:00
|
|
|
0: {0, "u.full_name"},
|
|
|
|
1: {1, "u.full_name"},
|
2018-12-28 12:07:35 +00:00
|
|
|
2: {2, "u.email"},
|
|
|
|
3: {3, "u.created_at"},
|
2019-03-27 12:33:32 +00:00
|
|
|
4: {4, "u.full_name"},
|
2018-12-28 12:07:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
for _, tc := range testCases {
|
2019-01-15 13:03:24 +00:00
|
|
|
assert.Equal(t, tc.orderColumn, sanitizedOrderColumnName(console.ProjectMemberOrder(tc.orderNumber)))
|
2018-12-28 12:07:35 +00:00
|
|
|
}
|
|
|
|
}
|