Skip to content

Commit

Permalink
Merge pull request #1070 from wakatime/misc/summary-tests
Browse files Browse the repository at this point in the history
Trim spaces in summary tests
  • Loading branch information
alanhamlett authored Jul 23, 2024
2 parents f0a62d7 + e25375d commit f185013
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions pkg/summary/summary_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func TestRenderToday(t *testing.T) {
rendered, err := summary.RenderToday(testSummary(), false, test.Output)
require.NoError(t, err)

assert.Equal(t, strings.TrimSpace(test.Expected), strings.TrimSpace(rendered))
assert.Equal(t, test.Expected, rendered)
})
}
}
Expand All @@ -62,7 +62,7 @@ func readFile(t *testing.T, fp string) string {
data, err := os.ReadFile(fp)
require.NoError(t, err)

return string(data)
return strings.TrimSpace(string(data))
}

func testSummary() *summary.Summary {
Expand Down
2 changes: 1 addition & 1 deletion pkg/summary/testdata/statusbar_today.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"cached_at":"2023-01-29T17:32:05Z","data":{"categories":[{"decimal":"2.28","digital":"2:17:36","hours":2,"minutes":17,"name":"Coding","percent":99.02,"seconds":36,"text":"2 hrs 17 mins","total_seconds":8256.598234},{"decimal":"0.00","digital":"0:00:07","hours":0,"minutes":0,"name":"Debugging","percent":0.08,"seconds":7,"text":"7 secs","total_seconds":7.100772}],"dependencies":[{"decimal":"1.25","digital":"1:15:44","hours":1,"minutes":15,"name":"strings","percent":64.82,"seconds":44,"text":"1 hr 15 mins","total_seconds":4544.055638},{"decimal":"0.82","digital":"0:49:06","hours":0,"minutes":49,"name":"io","percent":35.18,"seconds":6,"text":"49 mins","total_seconds":2946.01205}],"editors":[{"decimal":"2.07","digital":"2:04:07","hours":2,"minutes":4,"name":"VS Code","percent":90.2,"seconds":7,"text":"2 hrs 4 mins","total_seconds":7447.112447},{"decimal":"0.22","digital":"0:13:29","hours":0,"minutes":13,"name":"Zsh-Wakatime-Sobolevn","percent":9.8,"seconds":29,"text":"13 mins","total_seconds":809.485787}],"grand_total":{"decimal":"2.28","digital":"2:17","hours":2,"minutes":17,"text":"2 hrs 17 mins","total_seconds":8256.598234},"languages":[{"decimal":"1.93","digital":"1:56:49","hours":1,"minutes":56,"name":"Go","percent":86.15,"seconds":49,"text":"1 hr 56 mins","total_seconds":7009.317188},{"decimal":"0.27","digital":"0:16:11","hours":0,"minutes":16,"name":"Other","percent":13.85,"seconds":11,"text":"16 mins","total_seconds":971.489169}],"machines":[{"decimal":"2.28","digital":"2:17:36","hours":2,"machine_name_id":"370471e8-b6dd-41aa-a94e-d4fb59a7db85","minutes":17,"name":"WakaMachine","percent":100,"seconds":36,"text":"2 hrs 17 mins","total_seconds":8256.598234}],"operating_systems":[{"decimal":"2.28","digital":"2:17:36","hours":2,"minutes":17,"name":"Mac","percent":100,"seconds":36,"text":"2 hrs 17 mins","total_seconds":8256.598234}],"projects":[{"decimal":"2.05","digital":"2:03:44","hours":2,"minutes":3,"name":"wakatime-cli","percent":97.53,"seconds":44,"text":"2 hrs 3 mins","total_seconds":7424.621273},{"decimal":"0.05","digital":"0:03:02","hours":0,"minutes":3,"name":"Terminal","percent":2.46,"seconds":2,"text":"3 mins","total_seconds":182.934009}],"range":{"date":"2023-01-29","end":"2023-01-30T02:59:59Z","start":"2023-01-29T03:00:00Z","text":"Sun Jan 29th 2023","timezone":"America/Sao_Paulo"}},"has_team_features":true}
{"cached_at":"2023-01-29T17:32:05Z","data":{"categories":[{"decimal":"2.28","digital":"2:17:36","hours":2,"minutes":17,"name":"Coding","percent":99.02,"seconds":36,"text":"2 hrs 17 mins","total_seconds":8256.598234},{"decimal":"0.00","digital":"0:00:07","hours":0,"minutes":0,"name":"Debugging","percent":0.08,"seconds":7,"text":"7 secs","total_seconds":7.100772}],"dependencies":[{"decimal":"1.25","digital":"1:15:44","hours":1,"minutes":15,"name":"strings","percent":64.82,"seconds":44,"text":"1 hr 15 mins","total_seconds":4544.055638},{"decimal":"0.82","digital":"0:49:06","hours":0,"minutes":49,"name":"io","percent":35.18,"seconds":6,"text":"49 mins","total_seconds":2946.01205}],"editors":[{"decimal":"2.07","digital":"2:04:07","hours":2,"minutes":4,"name":"VS Code","percent":90.2,"seconds":7,"text":"2 hrs 4 mins","total_seconds":7447.112447},{"decimal":"0.22","digital":"0:13:29","hours":0,"minutes":13,"name":"Zsh-Wakatime-Sobolevn","percent":9.8,"seconds":29,"text":"13 mins","total_seconds":809.485787}],"grand_total":{"decimal":"2.28","digital":"2:17","hours":2,"minutes":17,"text":"2 hrs 17 mins","total_seconds":8256.598234},"languages":[{"decimal":"1.93","digital":"1:56:49","hours":1,"minutes":56,"name":"Go","percent":86.15,"seconds":49,"text":"1 hr 56 mins","total_seconds":7009.317188},{"decimal":"0.27","digital":"0:16:11","hours":0,"minutes":16,"name":"Other","percent":13.85,"seconds":11,"text":"16 mins","total_seconds":971.489169}],"machines":[{"decimal":"2.28","digital":"2:17:36","hours":2,"machine_name_id":"370471e8-b6dd-41aa-a94e-d4fb59a7db85","minutes":17,"name":"WakaMachine","percent":100,"seconds":36,"text":"2 hrs 17 mins","total_seconds":8256.598234}],"operating_systems":[{"decimal":"2.28","digital":"2:17:36","hours":2,"minutes":17,"name":"Mac","percent":100,"seconds":36,"text":"2 hrs 17 mins","total_seconds":8256.598234}],"projects":[{"decimal":"2.05","digital":"2:03:44","hours":2,"minutes":3,"name":"wakatime-cli","percent":97.53,"seconds":44,"text":"2 hrs 3 mins","total_seconds":7424.621273},{"decimal":"0.05","digital":"0:03:02","hours":0,"minutes":3,"name":"Terminal","percent":2.46,"seconds":2,"text":"3 mins","total_seconds":182.934009}],"range":{"date":"2023-01-29","end":"2023-01-30T02:59:59Z","start":"2023-01-29T03:00:00Z","text":"Sun Jan 29th 2023","timezone":"America/Sao_Paulo"}},"has_team_features":true}

0 comments on commit f185013

Please sign in to comment.