Compare commits

1 Commits
Author SHA1 Message Date
ben 1877fee258 Fix flaky transcription duration assertion in CI.
CI / test (push) Successful in 20s
CI / build-and-push (push) Successful in 38s
CI / deploy (push) Successful in 9s
Use integer timestamps for duration and pin the test clock to a whole second so SQLite round-trips stay stable.
2026-08-13 00:49:53 +02:00
2 changed files with 6 additions and 2 deletions
+1 -1
View File
@@ -434,7 +434,7 @@ class Recording extends Model
$startedAt = $this->transcription_started_at; $startedAt = $this->transcription_started_at;
$durationSeconds = $startedAt === null $durationSeconds = $startedAt === null
? null ? null
: max(0, (int) round($startedAt->diffInSeconds($finishedAt))); : max(0, $finishedAt->getTimestamp() - $startedAt->getTimestamp());
$this->forceFill([ $this->forceFill([
'transcript' => $text, 'transcript' => $text,
+5 -1
View File
@@ -210,7 +210,7 @@ class RecordingUploadTest extends TestCase
Transcription::fake(['Hello from the recorder.']); Transcription::fake(['Hello from the recorder.']);
$this->freezeTime(); $this->travelTo(now()->startOfSecond());
$recording = Recording::query()->create([ $recording = Recording::query()->create([
'user_id' => $this->user->id, 'user_id' => $this->user->id,
@@ -231,6 +231,10 @@ class RecordingUploadTest extends TestCase
$this->assertSame(100, $recording->transcription_percent); $this->assertSame(100, $recording->transcription_percent);
$this->assertSame('Transcription complete', $recording->transcription_progress); $this->assertSame('Transcription complete', $recording->transcription_progress);
$this->assertNotNull($recording->transcribed_at); $this->assertNotNull($recording->transcribed_at);
$this->assertSame(
$recording->transcribed_at->getTimestamp() - $recording->transcription_started_at->getTimestamp(),
$recording->transcription_duration_seconds,
);
$this->assertSame(42, $recording->transcription_duration_seconds); $this->assertSame(42, $recording->transcription_duration_seconds);
$this->assertSame('42s', $recording->transcriptionStatusPayload()['transcription_duration_human']); $this->assertSame('42s', $recording->transcriptionStatusPayload()['transcription_duration_human']);
} }