proxy_expiry_test.go 667 B

123456789101112131415161718192021222324252627
  1. package repository
  2. import (
  3. "testing"
  4. "github.com/stretchr/testify/require"
  5. )
  6. func TestSortedUniqueAccountIDs(t *testing.T) {
  7. tests := []struct {
  8. name string
  9. input []int64
  10. want []int64
  11. }{
  12. {name: "unsorted duplicates", input: []int64{12, 3, 12, 8, 3}, want: []int64{3, 8, 12}},
  13. {name: "already sorted", input: []int64{3, 8, 12}, want: []int64{3, 8, 12}},
  14. {name: "single", input: []int64{3}, want: []int64{3}},
  15. {name: "empty", input: []int64{}, want: []int64{}},
  16. {name: "nil", input: nil, want: nil},
  17. }
  18. for _, tt := range tests {
  19. t.Run(tt.name, func(t *testing.T) {
  20. require.Equal(t, tt.want, sortedUniqueAccountIDs(tt.input))
  21. })
  22. }
  23. }