Skip to content

Conversation

@aokj4ck
Copy link
Contributor

@aokj4ck aokj4ck commented Sep 20, 2025

Description

  • MastodonMetricFormatter accepts a number such as 1234, and converts it to an abbreviated form: "1.2K" in the US and "1,2K" in the EU.
    • Add MastodonMetricFormatter.abbreviatedGroupingSeparator to allow changing the separator.
    • The default values of abbreviatedGroupingSeparator are: period in the US and comma in the EU.
    • Update the unit tests to explicitly assign abbreviatedGroupingSeparator = "," for EU-styled test assertions.
    • Update the test_thousandNinetynineFormat() test function to explicitly test abbreviatedGroupingSeparator with both EU (,) and US (.) separators.
  • Fix MastodonTests.testWebFinger() to fulfill the test expectation exactly once, and on the main thread.
  • Update MastodonTests.testConnectOnion() to report an XCTFail() instead of an assertion failure so that the process can exit cleanly and report the test failure instead of halting.
    • testConnectOnion is currently failing, there may be additional servers that this works with but I haven't been able to run a passing test.

/// The number formatter instance that will be used. May be customized through ``abbreviatedGroupingSeparator``.
private let numberFormatter = NumberFormatter()

/// MastodonMetricFormatter first converts to decimel _then_ displays the value.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo - decimel vs. decimal

@whattherestimefor whattherestimefor merged commit a07a257 into mastodon:develop Sep 23, 2025
2 checks passed
@aokj4ck aokj4ck deleted the fix/metric-formatter-tests branch September 23, 2025 17:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants