MCPcopy Create free account
hub / github.com/github/gh-aw / TestComputeGitHubRateLimitDiff_WithData

Function TestComputeGitHubRateLimitDiff_WithData

pkg/cli/audit_diff_test.go:973–1000  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

971}
972
973func TestComputeGitHubRateLimitDiff_WithData(t *testing.T) {
974 rl1 := &GitHubRateLimitUsage{
975 TotalRequestsMade: 40,
976 CoreConsumed: 40,
977 CoreRemaining: 4960,
978 CoreLimit: 5000,
979 }
980 rl2 := &GitHubRateLimitUsage{
981 TotalRequestsMade: 60,
982 CoreConsumed: 60,
983 CoreRemaining: 4940,
984 CoreLimit: 5000,
985 }
986
987 diff := computeGitHubRateLimitDiff(rl1, rl2)
988 require.NotNil(t, diff, "diff should not be nil")
989
990 assert.Equal(t, 40, diff.Run1TotalAPICalls, "Run1 total API calls should be 40")
991 assert.Equal(t, 60, diff.Run2TotalAPICalls, "Run2 total API calls should be 60")
992 assert.Equal(t, "+50%", diff.APICallsChange, "API calls should increase by 50%")
993 assert.Equal(t, 40, diff.Run1CoreConsumed, "Run1 core consumed should be 40")
994 assert.Equal(t, 60, diff.Run2CoreConsumed, "Run2 core consumed should be 60")
995 assert.Equal(t, "+50%", diff.CoreConsumedChange, "Core consumed should increase by 50%")
996 assert.Equal(t, 4960, diff.Run1CoreRemaining, "Run1 core remaining should be 4960")
997 assert.Equal(t, 4940, diff.Run2CoreRemaining, "Run2 core remaining should be 4940")
998 assert.Equal(t, 5000, diff.Run1CoreLimit, "Run1 core limit should be 5000")
999 assert.Equal(t, 5000, diff.Run2CoreLimit, "Run2 core limit should be 5000")
1000}
1001
1002func TestComputeGitHubRateLimitDiff_Run1Nil(t *testing.T) {
1003 rl2 := &GitHubRateLimitUsage{

Callers

nothing calls this directly

Calls 1

Tested by

no test coverage detected