@@ -18,8 +18,8 @@ struct SettingsScreenTests {
18
18
#expect( screen. currentUser != nil )
19
19
}
20
20
21
- @Test ( " Too large avatar produces a failure" )
22
- func tooLargeAvatarProducesFailure ( ) async throws {
21
+ @Test ( " Updating avatar with a too large image produces a failure" )
22
+ func updateAvatarTooLargeProducesFailure ( ) async throws {
23
23
let eventBus = StoringEventBus ( )
24
24
let screen = FakeScreen ( eventBus: eventBus, api: . fake( ) )
25
25
await screen. getCurrentUser ( )
@@ -29,8 +29,8 @@ struct SettingsScreenTests {
29
29
#expect( screen. currentUser? . avatar == " " )
30
30
}
31
31
32
- @Test ( " Not image avatar produces a failure" )
33
- func notImageAvatarProducesFailure ( ) async throws {
32
+ @Test ( " Updating avatar with an invalid image produces a failure" )
33
+ func updateAvatarNotImageProducesFailure ( ) async throws {
34
34
let eventBus = StoringEventBus ( )
35
35
let screen = FakeScreen ( eventBus: eventBus, api: . fake( ) )
36
36
await screen. getCurrentUser ( )
@@ -40,8 +40,8 @@ struct SettingsScreenTests {
40
40
#expect( screen. currentUser? . avatar == " " )
41
41
}
42
42
43
- @Test ( " Valid avatar produces no failures" )
44
- func validAvatarProducesNoFailures ( ) async throws {
43
+ @Test ( " Updating avatar with a valid image produces no failures" )
44
+ func updateAvatarValidProducesNoFailures ( ) async throws {
45
45
let eventBus = StoringEventBus ( )
46
46
let screen = FakeScreen ( eventBus: eventBus, api: . fake( ) )
47
47
await screen. getCurrentUser ( )
@@ -50,4 +50,16 @@ struct SettingsScreenTests {
50
50
#expect( eventBus. storedEvents. isEmpty)
51
51
#expect( screen. currentUser? . avatar == FakeClient . avatar)
52
52
}
53
+
54
+ @Test ( " Removing avatar produces no failures " )
55
+ func removeAvatarProducesNoFailures( ) async throws {
56
+ let eventBus = StoringEventBus ( )
57
+ let screen = FakeScreen ( eventBus: eventBus, api: . fake( ) )
58
+ await screen. getCurrentUser ( )
59
+ await screen. updateAvatar (
60
+ with: try await . init( collecting: FakeClient . normalImageBody, upTo: 64 ) )
61
+ await screen. removeAvatar ( )
62
+ #expect( eventBus. storedEvents. isEmpty)
63
+ #expect( screen. currentUser? . avatar == " " )
64
+ }
53
65
}
0 commit comments