Make test stricter

This commit is contained in:
Anant Prakash 2018-07-25 01:42:11 +05:30
parent a970264690
commit 59aa8683f1
No known key found for this signature in database
GPG key ID: C5D399F626523045

View file

@ -42,18 +42,18 @@ func TestTypingCache(t *testing.T) {
func testAddTypingUser(t *testing.T, tCache *TypingCache) { func testAddTypingUser(t *testing.T, tCache *TypingCache) {
timeAfterDefaultInterval := time.Now().Add(defaultInterval) timeAfterDefaultInterval := time.Now().Add(defaultInterval)
timeAfterTwiceDefaultInterval := time.Now().Add(2 * defaultInterval)
tests := []struct { tests := []struct {
userID string userID string
roomID string roomID string
expire *time.Time expire *time.Time
}{ }{ // Set four users typing state to room1
{"user1", "room1", nil}, {"user1", "room1", nil},
{"user2", "room1", nil}, {"user2", "room1", nil},
{"user3", "room1", nil}, {"user3", "room1", nil},
{"user4", "room1", nil}, {"user4", "room1", nil},
// Override timeout
{"user1", "room2", &timeAfterDefaultInterval}, {"user1", "room2", &timeAfterDefaultInterval},
{"user1", "room2", &timeAfterTwiceDefaultInterval}, {"user1", "room2", nil},
} }
for _, tt := range tests { for _, tt := range tests {