mirror of
https://github.com/go-gitea/gitea
synced 2024-12-25 01:54:26 +00:00
* Update heatmap fixtures to restore tests * Add hint to check the fixture age on fail
This commit is contained in:
parent
cf35355db8
commit
afeab941b3
@ -26,7 +26,7 @@ func TestUserHeatmap(t *testing.T) {
|
|||||||
var heatmap []*models.UserHeatmapData
|
var heatmap []*models.UserHeatmapData
|
||||||
DecodeJSON(t, resp, &heatmap)
|
DecodeJSON(t, resp, &heatmap)
|
||||||
var dummyheatmap []*models.UserHeatmapData
|
var dummyheatmap []*models.UserHeatmapData
|
||||||
dummyheatmap = append(dummyheatmap, &models.UserHeatmapData{Timestamp: 1540080000, Contributions: 1})
|
dummyheatmap = append(dummyheatmap, &models.UserHeatmapData{Timestamp: 1571616000, Contributions: 1})
|
||||||
|
|
||||||
assert.Equal(t, dummyheatmap, heatmap)
|
assert.Equal(t, dummyheatmap, heatmap)
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
act_user_id: 2
|
act_user_id: 2
|
||||||
repo_id: 2
|
repo_id: 2
|
||||||
is_private: true
|
is_private: true
|
||||||
created_unix: 1540139562
|
created_unix: 1571686356
|
||||||
|
|
||||||
-
|
-
|
||||||
id: 2
|
id: 2
|
||||||
|
@ -17,7 +17,7 @@ func TestGetUserHeatmapDataByUser(t *testing.T) {
|
|||||||
CountResult int
|
CountResult int
|
||||||
JSONResult string
|
JSONResult string
|
||||||
}{
|
}{
|
||||||
{2, 1, `[{"timestamp":1540080000,"contributions":1}]`},
|
{2, 1, `[{"timestamp":1571616000,"contributions":1}]`},
|
||||||
{3, 0, `[]`},
|
{3, 0, `[]`},
|
||||||
}
|
}
|
||||||
// Prepare
|
// Prepare
|
||||||
@ -41,7 +41,7 @@ func TestGetUserHeatmapDataByUser(t *testing.T) {
|
|||||||
// Get the heatmap and compare
|
// Get the heatmap and compare
|
||||||
heatmap, err := GetUserHeatmapDataByUser(user)
|
heatmap, err := GetUserHeatmapDataByUser(user)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
assert.Equal(t, len(actions), len(heatmap))
|
assert.Equal(t, len(actions), len(heatmap), "invalid action count: did the test data became too old?")
|
||||||
assert.Equal(t, tc.CountResult, len(heatmap))
|
assert.Equal(t, tc.CountResult, len(heatmap))
|
||||||
|
|
||||||
//Test JSON rendering
|
//Test JSON rendering
|
||||||
|
Loading…
Reference in New Issue
Block a user