mirror of
https://github.com/matrix-org/dendrite.git
synced 2024-11-22 14:21:55 -06:00
Fix UTs
This commit is contained in:
parent
f1ccfcf150
commit
1aa70b0f56
|
@ -187,8 +187,8 @@ func Test_UserStatistics(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("Users not active for one/two month", func(t *testing.T) {
|
||||
mustUpdateDeviceLastSeen(t, ctx, db, "user1", time.Now().AddDate(0, -2, 0))
|
||||
mustUpdateDeviceLastSeen(t, ctx, db, "user2", time.Now().AddDate(0, -1, 0))
|
||||
mustUpdateDeviceLastSeen(t, ctx, db, "user1", time.Now().AddDate(0, 0, -60))
|
||||
mustUpdateDeviceLastSeen(t, ctx, db, "user2", time.Now().AddDate(0, 0, -30))
|
||||
gotStats, _, err := statsDB.UserStatistics(ctx, nil)
|
||||
if err != nil {
|
||||
t.Fatalf("unexpected error: %v", err)
|
||||
|
@ -224,9 +224,9 @@ func Test_UserStatistics(t *testing.T) {
|
|||
- Where account creation and last_seen are > 30 days apart
|
||||
*/
|
||||
t.Run("R30Users tests", func(t *testing.T) {
|
||||
mustUserUpdateRegistered(t, ctx, db, "user1", time.Now().AddDate(0, -2, 0))
|
||||
mustUserUpdateRegistered(t, ctx, db, "user1", time.Now().AddDate(0, 0, -60))
|
||||
mustUpdateDeviceLastSeen(t, ctx, db, "user1", time.Now())
|
||||
mustUserUpdateRegistered(t, ctx, db, "user4", time.Now().AddDate(0, -2, 0))
|
||||
mustUserUpdateRegistered(t, ctx, db, "user4", time.Now().AddDate(0, 0, -60))
|
||||
mustUpdateDeviceLastSeen(t, ctx, db, "user4", time.Now())
|
||||
startTime := time.Now().AddDate(0, 0, -2)
|
||||
err := statsDB.UpdateUserDailyVisits(ctx, nil, startTime, startTime.Truncate(time.Hour*24))
|
||||
|
|
Loading…
Reference in a new issue