@@ -25,7 +25,7 @@ func TestUsers_Accept(t *testing.T) {
25
25
issueTime := time .Date (2020 , 05 , 11 , 8 , 0 , 0 , 0 , time .UTC )
26
26
issueTime2 := time .Date (2020 , 05 , 12 , 8 , 0 , 0 , 0 , time .UTC )
27
27
28
- t .Run ("can get all users ordered by creation timestamp" , func (t * testing.T ) {
28
+ t .Run ("can get all users ordered by descending creation timestamp" , func (t * testing.T ) {
29
29
// Given
30
30
users := projection .NewUsers ()
31
31
record1 := rangedbtest .DummyRecordFromEvent (& goauth2.UserWasOnBoarded {
@@ -53,6 +53,31 @@ func TestUsers_Accept(t *testing.T) {
53
53
assert .Equal (t , uint64 (issueTime2 .Unix ()), actualUsers [0 ].CreateTimestamp )
54
54
})
55
55
56
+ t .Run ("can get all users ordered by creation timestamp, then by ascending userID" , func (t * testing.T ) {
57
+ // Given
58
+ users := projection .NewUsers ()
59
+ record1 := rangedbtest .DummyRecordFromEvent (& goauth2.UserWasOnBoarded {
60
+ UserID : userID ,
61
+ Username : username ,
62
+ PasswordHash : passwordHash ,
63
+ })
64
+ record2 := rangedbtest .DummyRecordFromEvent (& goauth2.UserWasOnBoarded {
65
+ UserID : userID2 ,
66
+ Username : username2 ,
67
+ PasswordHash : passwordHash ,
68
+ })
69
+ users .Accept (record2 )
70
+ users .Accept (record1 )
71
+
72
+ // When
73
+ actualUsers := users .GetAll ()
74
+
75
+ // Then
76
+ assert .Len (t , actualUsers , 2 )
77
+ assert .Equal (t , userID2 , actualUsers [0 ].UserID )
78
+ assert .Equal (t , username2 , actualUsers [0 ].Username )
79
+ })
80
+
56
81
t .Run ("includes admin flag" , func (t * testing.T ) {
57
82
// Given
58
83
users := projection .NewUsers ()
0 commit comments