Commit Graph

3 Commits

Author SHA1 Message Date
Nik Clayton 9b99a78d1f
test: Ensure that all relevant MastodonAPI methods are stubbed (#1001)
Tests that rely on stubbing the MastodonAPI may have incorrect behaviour
if some of the API methods called by the system-under-test are not
stubbed. This can be difficult to track down.

Make this easier by adding a default answer for the MastodonAPI used in
tests. Any un-stubbed methods will throw an `AssertionError` with enough
information to identify the method that should be stubbed and where it
was called from.
2024-10-13 17:18:54 +02:00
Nik Clayton 286a152fde change: Move MediaUploadApi to the correct package 2024-04-30 16:23:34 +02:00
Nik Clayton 362cdfeb27
fix: Prevent crash when Pachli is a share target (#659)
Crash was occuring because the instance info hadn't been fetched, trying
to take the last item of an empty list.

To fix:

- Expose the instance info as a state flow, with a default. New instance
info is fetched whenever the active account changes.

- Do the same for the emojis supported by the server.

- Update call sites as appropriate.

- Mark `InstanceInfoRepository` as `@Singleton` so it isn't repeatedly
created causing fresh content fetches.

The tests needed updating to get this to work.

- Extract the network fake modules in to a network-test module so
multiple other modules can use them.

- Rewrite `InstanceInfoRepositoryTest` to use Hilt and use Turbine to
test the new flows.

Checking this showed cosmetic bugs in the About layout when instance
info is missing, clean those up.
2024-04-28 18:19:13 +02:00