Skip to content

Commit

Permalink
Make badge text lowercase so it matches the other badges (build, test…
Browse files Browse the repository at this point in the history
…s, coverage)
  • Loading branch information
Aldaviva committed Jun 18, 2024
1 parent 668fd42 commit 297df3b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions GamesDoneQuickCalendarFactory/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@ async Task (ICalendarGenerator calendarGenerator, HttpResponse response, [FromQu
webApp.MapGet("/badge.json", [OutputCache(Duration = CACHE_DURATION_MINUTES * 60)] async (IEventDownloader eventDownloader) =>
await eventDownloader.downloadSchedule() is { } schedule
? new ShieldsBadgeResponse(
label: Regex.Replace(schedule.shortTitle, @"(?<=\D)(?=\d)|(?<=[a-z])(?=[A-Z])", " "), // add spaces to abbreviation
label: Regex.Replace(schedule.shortTitle, @"(?<=\D)(?=\d)|(?<=[a-z])(?=[A-Z])", " ").ToLower(), // add spaces to abbreviation
message: $"{schedule.runs.Count} {(schedule.runs.Count == 1 ? "run" : "runs")}",
color: "success",
logoSvg: Resources.gdqDpadBadgeLogo)
: new ShieldsBadgeResponse("GDQ", "no event now", "important", false, Resources.gdqDpadBadgeLogo));
: new ShieldsBadgeResponse("gdq", "no event now", "important", false, Resources.gdqDpadBadgeLogo));

webApp.Run();
6 changes: 3 additions & 3 deletions Tests/ServerTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ public async Task badgeJson() {

response.Should().NotBeNull();
response!["schemaVersion"]!.GetValue<int>().Should().Be(1);
response["label"]!.GetValue<string>().Should().Be("AGDQ 2024");
response["label"]!.GetValue<string>().Should().Be("agdq 2024");
response["message"]!.GetValue<string>().Should().Be("145 runs");
response["color"]!.GetValue<string>().Should().Be("success");
response["isError"]!.GetValue<bool>().Should().BeFalse();
Expand All @@ -116,7 +116,7 @@ public async Task badgeJsonFrameFatales() {

JsonObject? response = await client.GetFromJsonAsync<JsonObject>("/badge.json");

response?["label"]?.GetValue<string>().Should().Be("Frost Fatales 2024");
response?["label"]?.GetValue<string>().Should().Be("frost fatales 2024");
}

[Fact]
Expand All @@ -127,7 +127,7 @@ public async Task badgeJsonEmpty() {

response.Should().NotBeNull();
response!["schemaVersion"]!.GetValue<int>().Should().Be(1);
response["label"]!.GetValue<string>().Should().Be("GDQ");
response["label"]!.GetValue<string>().Should().Be("gdq");
response["message"]!.GetValue<string>().Should().Be("no event now");
response["color"]!.GetValue<string>().Should().Be("important");
response["isError"]!.GetValue<bool>().Should().BeFalse();
Expand Down

0 comments on commit 297df3b

Please sign in to comment.