Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
alanhamlett committed Jul 19, 2024
1 parent df215b4 commit ca990df
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ func TestSendHeartbeats_ExtraHeartbeats(t *testing.T) {
offlineCount, err := offline.CountHeartbeats(offlineQueueFile.Name())
require.NoError(t, err)

assert.Zero(t, offlineCount)
assert.Equal(t, 1, offlineCount)

assert.Eventually(t, func() bool { return numCalls == 2 }, time.Second, 50*time.Millisecond)
}
Expand Down Expand Up @@ -357,6 +357,8 @@ func TestSendHeartbeats_ExtraHeartbeats_SyncLegacyOfflineActivity(t *testing.T)
filename = "testdata/api_heartbeats_response_extra_heartbeats_legacy_offline.json"
case 3:
filename = "testdata/api_heartbeats_response_extra_heartbeats_extra.json"
case 4:
filename = "testdata/api_heartbeats_response_extra_heartbeats_extra.json"
}

// write response
Expand Down Expand Up @@ -455,7 +457,7 @@ func TestSendHeartbeats_ExtraHeartbeats_SyncLegacyOfflineActivity(t *testing.T)

assert.Zero(t, offlineCount)

assert.Eventually(t, func() bool { return numCalls == 3 }, time.Second, 50*time.Millisecond)
assert.Eventually(t, func() bool { return numCalls == 4 }, time.Second, 50*time.Millisecond)
}

func TestSendHeartbeats_OfflineOnly(t *testing.T) {
Expand Down Expand Up @@ -497,7 +499,7 @@ func TestSendHeartbeats_OfflineOnly(t *testing.T) {
"--internal-config", tmpInternalConfigFile.Name(),
"--entity", "testdata/main.go",
"--extra-heartbeats", "true",
"--cursorpos", "12",
"--cursorpos", "100",
"--offline-queue-file", offlineQueueFile.Name(),
"--offline-only",
"--lineno", "42",
Expand Down

0 comments on commit ca990df

Please sign in to comment.