15
15
@testable import App
16
16
17
17
import InlineSnapshotTesting
18
+ import NIOConcurrencyHelpers
18
19
import XCTVapor
19
20
20
21
@@ -190,16 +191,16 @@ class SocialTests: AppTestCase {
190
191
let jpr = try await Package . fetchCandidate ( app. db, id: pkg. id!)
191
192
let versions = try await Analyze . updateLatestVersions ( on: app. db, package : jpr)
192
193
193
- let posted = ActorIsolated ( 0 )
194
- Current . mastodonPost = { _, _ in await posted. increment ( ) }
194
+ let posted : NIOLockedValueBox < Int > = . init ( 0 )
195
+ Current . mastodonPost = { _, _ in posted. withLockedValue { $0 += 1 } }
195
196
196
197
// MUT
197
198
try await Social . postToFirehose ( client: app. client,
198
199
package : jpr,
199
200
versions: versions)
200
201
201
202
// validate
202
- try await XCTAssertEqualAsync ( await posted. value , 2 )
203
+ try await XCTAssertEqualAsync ( posted. withLockedValue { $0 } , 2 )
203
204
}
204
205
205
206
func test_postToFirehose_only_latest( ) async throws {
@@ -218,10 +219,10 @@ class SocialTests: AppTestCase {
218
219
let jpr = try await Package . fetchCandidate ( app. db, id: pkg. id!)
219
220
let versions = try await Analyze . updateLatestVersions ( on: app. db, package : jpr)
220
221
221
- let posted = ActorIsolated ( 0 )
222
+ let posted : NIOLockedValueBox < Int > = . init ( 0 )
222
223
Current . mastodonPost = { _, msg in
223
224
XCTAssertTrue ( msg. contains ( " v2.0.0 " ) )
224
- await posted. increment ( )
225
+ posted. withLockedValue { $0 += 1 }
225
226
}
226
227
227
228
// MUT
@@ -230,7 +231,7 @@ class SocialTests: AppTestCase {
230
231
versions: versions)
231
232
232
233
// validate
233
- try await XCTAssertEqualAsync ( await posted. value , 1 )
234
+ try await XCTAssertEqualAsync ( posted. withLockedValue { $0 } , 1 )
234
235
}
235
236
236
237
func test_urlEncoding( ) async throws {
0 commit comments