Skip to content

Commit 997ed86

Browse files
committed
wip
1 parent 8f21873 commit 997ed86

File tree

2 files changed

+17
-6
lines changed

2 files changed

+17
-6
lines changed

.github/workflows/ci.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,20 @@ jobs:
5252
strategy:
5353
matrix:
5454
command: [test, '']
55-
platform: [IOS, MAC_CATALYST, MACOS, TVOS, VISIONOS, WATCHOS]
55+
platform:
56+
- IOS
57+
- MAC_CATALYST
58+
- MACOS
59+
- TVOS
60+
# - VISIONOS # Unfortunately, visionOS on CI is too flakey
61+
- WATCHOS
5662
xcode: [15.2, 15.4]
5763
exclude:
5864
- {xcode: 15.2, command: test}
5965
- {xcode: 15.4, command: ''}
6066
- {xcode: 15.2, platform: MAC_CATALYST}
6167
- {xcode: 15.2, platform: TVOS}
62-
- {xcode: 15.2, platform: VISIONOS}
68+
# - {xcode: 15.2, platform: VISIONOS}
6369
- {xcode: 15.2, platform: WATCHOS}
6470
include:
6571
- {xcode: 15.2, skip_release: 1}

Examples/VoiceMemos/VoiceMemosTests/VoiceMemosTests.swift

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,14 @@ struct VoiceMemosTests {
1212
@Test
1313
func recordAndPlayback() async throws {
1414
let didFinish = AsyncThrowingStream.makeStream(of: Bool.self)
15-
let clock = TestClock()
15+
// NB: We would prefer to use a test clock here, but due to testing async still being unreliable
16+
// in Swift, we will use a real clock and sleep, instead.
17+
// let clock = TestClock()
1618
let store = TestStore(initialState: VoiceMemos.State()) {
1719
VoiceMemos()
1820
} withDependencies: {
1921
$0.audioPlayer.play = { @Sendable _ in
20-
try await clock.sleep(for: .milliseconds(2_500))
22+
try await Task.sleep(for: .milliseconds(2_500))
2123
return true
2224
}
2325
$0.audioRecorder.currentTime = { 2.5 }
@@ -30,7 +32,7 @@ struct VoiceMemosTests {
3032
didFinish.continuation.finish()
3133
}
3234
$0.date = .constant(Date(timeIntervalSinceReferenceDate: 0))
33-
$0.continuousClock = clock
35+
$0.continuousClock = ContinuousClock()
3436
$0.temporaryDirectory = { URL(fileURLWithPath: "/tmp") }
3537
$0.uuid = .constant(deadbeefID)
3638
}
@@ -68,7 +70,7 @@ struct VoiceMemosTests {
6870
$0.voiceMemos[id: deadbeefURL]?.mode = .playing(progress: 0)
6971
}
7072
await store.receive(\.voiceMemos[id: deadbeefURL].delegate.playbackStarted)
71-
await clock.run()
73+
try await Task.sleep(nanoseconds: 3_000_000_000)
7274

7375
await store.receive(\.voiceMemos[id: deadbeefURL].timerUpdated) {
7476
$0.voiceMemos[id: deadbeefURL]?.mode = .playing(progress: 0.2)
@@ -82,6 +84,9 @@ struct VoiceMemosTests {
8284
await store.receive(\.voiceMemos[id: deadbeefURL].timerUpdated) {
8385
$0.voiceMemos[id: deadbeefURL]?.mode = .playing(progress: 0.8)
8486
}
87+
await store.receive(\.voiceMemos[id: deadbeefURL].timerUpdated) {
88+
$0.voiceMemos[id: deadbeefURL]?.mode = .playing(progress: 1.0)
89+
}
8590
await store.receive(\.voiceMemos[id: deadbeefURL].audioPlayerClient.success) {
8691
$0.voiceMemos[id: deadbeefURL]?.mode = .notPlaying
8792
}

0 commit comments

Comments
 (0)