@@ -49,8 +49,7 @@ class SendCoordinatorTests: BitwardenTestCase {
49
49
50
50
/// `navigate(to:)` with `.addItem` presents the add send item screen.
51
51
@MainActor
52
- func test_navigateTo_addItem_hasPremium_withDelegate( ) throws {
53
- sendRepository. doesActivateAccountHavePremiumResult = . success( true )
52
+ func test_navigateTo_addItem_withDelegate( ) throws {
54
53
subject. navigate ( to: . addItem( ) , context: sendItemDelegate)
55
54
56
55
waitFor ( !stackNavigator. actions. isEmpty)
@@ -59,14 +58,13 @@ class SendCoordinatorTests: BitwardenTestCase {
59
58
XCTAssertTrue ( action. view is UINavigationController )
60
59
61
60
XCTAssertTrue ( module. sendItemCoordinator. isStarted)
62
- XCTAssertEqual ( module. sendItemCoordinator. routes. last, . add( content: nil , hasPremium : true ) )
61
+ XCTAssertEqual ( module. sendItemCoordinator. routes. last, . add( content: nil ) )
63
62
}
64
63
65
64
/// `navigate(to:)` with `.addItem` and without a delegate does not present the add send item
66
65
/// screen.
67
66
@MainActor
68
- func test_navigateTo_addItem_hasPremium_withoutDelegate( ) throws {
69
- sendRepository. doesActivateAccountHavePremiumResult = . success( true )
67
+ func test_navigateTo_addItem_withoutDelegate( ) throws {
70
68
subject. navigate ( to: . addItem( ) , context: nil )
71
69
72
70
XCTAssertFalse ( module. sendItemCoordinator. isStarted)
@@ -75,38 +73,7 @@ class SendCoordinatorTests: BitwardenTestCase {
75
73
76
74
/// `navigate(to:)` with `.addItem` presents the add send item screen.
77
75
@MainActor
78
- func test_navigateTo_addItem_notHasPremium( ) throws {
79
- sendRepository. doesActivateAccountHavePremiumResult = . success( false )
80
- subject. navigate ( to: . addItem( ) , context: sendItemDelegate)
81
-
82
- waitFor ( !stackNavigator. actions. isEmpty)
83
- let action = try XCTUnwrap ( stackNavigator. actions. last)
84
- XCTAssertEqual ( action. type, . presented)
85
- XCTAssertTrue ( action. view is UINavigationController )
86
-
87
- XCTAssertTrue ( module. sendItemCoordinator. isStarted)
88
- XCTAssertEqual ( module. sendItemCoordinator. routes. last, . add( content: nil , hasPremium: false ) )
89
- }
90
-
91
- /// `navigate(to:)` with `.addItem` presents the add send item screen.
92
- @MainActor
93
- func test_navigateTo_addItem_hasPremiumError( ) throws {
94
- sendRepository. doesActivateAccountHavePremiumResult = . failure( BitwardenTestError . example)
95
- subject. navigate ( to: . addItem( ) , context: sendItemDelegate)
96
-
97
- waitFor ( !stackNavigator. actions. isEmpty)
98
- let action = try XCTUnwrap ( stackNavigator. actions. last)
99
- XCTAssertEqual ( action. type, . presented)
100
- XCTAssertTrue ( action. view is UINavigationController )
101
-
102
- XCTAssertTrue ( module. sendItemCoordinator. isStarted)
103
- XCTAssertEqual ( module. sendItemCoordinator. routes. last, . add( content: nil , hasPremium: false ) )
104
- }
105
-
106
- /// `navigate(to:)` with `.addItem` presents the add send item screen.
107
- @MainActor
108
- func test_navigateTo_addItem_fileType_hasPremium_withDelegate( ) throws {
109
- sendRepository. doesActivateAccountHavePremiumResult = . success( true )
76
+ func test_navigateTo_addItem_fileType_withDelegate( ) throws {
110
77
subject. navigate ( to: . addItem( type: . file) , context: sendItemDelegate)
111
78
112
79
waitFor ( !stackNavigator. actions. isEmpty)
@@ -115,50 +82,19 @@ class SendCoordinatorTests: BitwardenTestCase {
115
82
XCTAssertTrue ( action. view is UINavigationController )
116
83
117
84
XCTAssertTrue ( module. sendItemCoordinator. isStarted)
118
- XCTAssertEqual ( module. sendItemCoordinator. routes. last, . add( content: . type( . file) , hasPremium : true ) )
85
+ XCTAssertEqual ( module. sendItemCoordinator. routes. last, . add( content: . type( . file) ) )
119
86
}
120
87
121
88
/// `navigate(to:)` with `.addItem` and without a delegate does not present the add send item
122
89
/// screen.
123
90
@MainActor
124
- func test_navigateTo_addItem_fileType_hasPremium_withoutDelegate( ) throws {
125
- sendRepository. doesActivateAccountHavePremiumResult = . success( true )
91
+ func test_navigateTo_addItem_fileType_withoutDelegate( ) throws {
126
92
subject. navigate ( to: . addItem( type: . file) , context: nil )
127
93
128
94
XCTAssertFalse ( module. sendItemCoordinator. isStarted)
129
95
XCTAssertTrue ( module. sendItemCoordinator. routes. isEmpty)
130
96
}
131
97
132
- /// `navigate(to:)` with `.addItem` presents the add send item screen.
133
- @MainActor
134
- func test_navigateTo_addItem_fileType_notHasPremium( ) throws {
135
- sendRepository. doesActivateAccountHavePremiumResult = . success( false )
136
- subject. navigate ( to: . addItem( type: . file) , context: sendItemDelegate)
137
-
138
- waitFor ( !stackNavigator. actions. isEmpty)
139
- let action = try XCTUnwrap ( stackNavigator. actions. last)
140
- XCTAssertEqual ( action. type, . presented)
141
- XCTAssertTrue ( action. view is UINavigationController )
142
-
143
- XCTAssertTrue ( module. sendItemCoordinator. isStarted)
144
- XCTAssertEqual ( module. sendItemCoordinator. routes. last, . add( content: . type( . file) , hasPremium: false ) )
145
- }
146
-
147
- /// `navigate(to:)` with `.addItem` presents the add send item screen.
148
- @MainActor
149
- func test_navigateTo_addItem_fileType_hasPremiumError( ) throws {
150
- sendRepository. doesActivateAccountHavePremiumResult = . failure( BitwardenTestError . example)
151
- subject. navigate ( to: . addItem( type: . file) , context: sendItemDelegate)
152
-
153
- waitFor ( !stackNavigator. actions. isEmpty)
154
- let action = try XCTUnwrap ( stackNavigator. actions. last)
155
- XCTAssertEqual ( action. type, . presented)
156
- XCTAssertTrue ( action. view is UINavigationController )
157
-
158
- XCTAssertTrue ( module. sendItemCoordinator. isStarted)
159
- XCTAssertEqual ( module. sendItemCoordinator. routes. last, . add( content: . type( . file) , hasPremium: false ) )
160
- }
161
-
162
98
/// `navigate(to:)` with `.dismiss` dismisses the current modally presented screen.
163
99
@MainActor
164
100
func test_navigateTo_dismiss( ) throws {
@@ -170,8 +106,7 @@ class SendCoordinatorTests: BitwardenTestCase {
170
106
171
107
/// `navigate(to:)` with `.editItem` presents the add send item screen.
172
108
@MainActor
173
- func test_navigateTo_editItem_hasPremium_withDelegate( ) throws {
174
- sendRepository. doesActivateAccountHavePremiumResult = . success( true )
109
+ func test_navigateTo_editItem_withDelegate( ) throws {
175
110
let sendView = SendView . fixture ( )
176
111
subject. navigate ( to: . editItem( sendView) , context: sendItemDelegate)
177
112
@@ -181,53 +116,20 @@ class SendCoordinatorTests: BitwardenTestCase {
181
116
XCTAssertTrue ( action. view is UINavigationController )
182
117
183
118
XCTAssertTrue ( module. sendItemCoordinator. isStarted)
184
- XCTAssertEqual ( module. sendItemCoordinator. routes. last, . edit( sendView, hasPremium : true ) )
119
+ XCTAssertEqual ( module. sendItemCoordinator. routes. last, . edit( sendView) )
185
120
}
186
121
187
122
/// `navigate(to:)` with `.editItem` and without a delegate does not present the add send item
188
123
/// screen.
189
124
@MainActor
190
- func test_navigateTo_editItem_hasPremium_withoutDelegate( ) throws {
191
- sendRepository. doesActivateAccountHavePremiumResult = . success( true )
125
+ func test_navigateTo_editItem_withoutDelegate( ) throws {
192
126
let sendView = SendView . fixture ( )
193
127
subject. navigate ( to: . editItem( sendView) , context: nil )
194
128
195
129
XCTAssertFalse ( module. sendItemCoordinator. isStarted)
196
130
XCTAssertTrue ( module. sendItemCoordinator. routes. isEmpty)
197
131
}
198
132
199
- /// `navigate(to:)` with `.editItem` presents the add send item screen.
200
- @MainActor
201
- func test_navigateTo_editItem_notHasPremium( ) throws {
202
- sendRepository. doesActivateAccountHavePremiumResult = . success( false )
203
- let sendView = SendView . fixture ( )
204
- subject. navigate ( to: . editItem( sendView) , context: sendItemDelegate)
205
-
206
- waitFor ( !stackNavigator. actions. isEmpty)
207
- let action = try XCTUnwrap ( stackNavigator. actions. last)
208
- XCTAssertEqual ( action. type, . presented)
209
- XCTAssertTrue ( action. view is UINavigationController )
210
-
211
- XCTAssertTrue ( module. sendItemCoordinator. isStarted)
212
- XCTAssertEqual ( module. sendItemCoordinator. routes. last, . edit( sendView, hasPremium: false ) )
213
- }
214
-
215
- /// `navigate(to:)` with `.editItem` presents the add send item screen.
216
- @MainActor
217
- func test_navigateTo_editItem_hasPremiumError( ) throws {
218
- sendRepository. doesActivateAccountHavePremiumResult = . failure( BitwardenTestError . example)
219
- let sendView = SendView . fixture ( )
220
- subject. navigate ( to: . editItem( sendView) , context: sendItemDelegate)
221
-
222
- waitFor ( !stackNavigator. actions. isEmpty)
223
- let action = try XCTUnwrap ( stackNavigator. actions. last)
224
- XCTAssertEqual ( action. type, . presented)
225
- XCTAssertTrue ( action. view is UINavigationController )
226
-
227
- XCTAssertTrue ( module. sendItemCoordinator. isStarted)
228
- XCTAssertEqual ( module. sendItemCoordinator. routes. last, . edit( sendView, hasPremium: false ) )
229
- }
230
-
231
133
/// `navigate(to:)` with `.group` pushes the send list screen for the type onto the stack.
232
134
@MainActor
233
135
func test_navigateTo_group( ) throws {
@@ -263,6 +165,20 @@ class SendCoordinatorTests: BitwardenTestCase {
263
165
XCTAssertTrue ( action. view is UIActivityViewController )
264
166
}
265
167
168
+ /// `navigate(to:)` with `.viewItem` presents the view send item screen
169
+ @MainActor
170
+ func test_navigateTo_viewItem( ) throws {
171
+ let sendView = SendView . fixture ( )
172
+ subject. navigate ( to: . viewItem( sendView) , context: sendItemDelegate)
173
+
174
+ let action = try XCTUnwrap ( stackNavigator. actions. last)
175
+ XCTAssertEqual ( action. type, . presented)
176
+ XCTAssertTrue ( action. view is UINavigationController )
177
+
178
+ XCTAssertTrue ( module. sendItemCoordinator. isStarted)
179
+ XCTAssertEqual ( module. sendItemCoordinator. routes. last, . view( sendView) )
180
+ }
181
+
266
182
/// `start()` initializes the coordinator's state correctly.
267
183
@MainActor
268
184
func test_start( ) throws {
0 commit comments