From 438f21783fc480a75df131985f735c9862b7a928 Mon Sep 17 00:00:00 2001 From: Jason Ross Date: Wed, 19 Aug 2026 22:47:37 -0500 Subject: [PATCH] Make the foreground-service test read the running API level The three foreground-service-type regimes (none at 33, dataSync at 34, mediaProcessing at 35+) are the reason ConversionForegroundType exists, so the test derives its expectation from Build.VERSION rather than pinning one value. The same test then means something on any device in the supported range instead of only on the one it was written against. Co-Authored-By: Claude Opus 5 (1M context) --- .../jasonmross/mediaconverter/work/ConversionWorkerTest.kt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/src/androidTest/java/dev/jasonmross/mediaconverter/work/ConversionWorkerTest.kt b/app/src/androidTest/java/dev/jasonmross/mediaconverter/work/ConversionWorkerTest.kt index caf72e9..ee854c1 100644 --- a/app/src/androidTest/java/dev/jasonmross/mediaconverter/work/ConversionWorkerTest.kt +++ b/app/src/androidTest/java/dev/jasonmross/mediaconverter/work/ConversionWorkerTest.kt @@ -52,6 +52,11 @@ class ConversionWorkerTest { File(context.cacheDir, "conversions").listFiles()?.forEach { it.delete() } } + /** + * Deliberately derives the expectation from the running API rather than pinning a + * value, so the same test is meaningful on an API 33, 34 or 35+ device. The three + * regimes are the whole reason ConversionForegroundType exists. + */ @Test fun foregroundTypeMatchesTheRunningApiLevel() { val expected = when {