fix(native): fix widget image management and add tests

- Fix `copyBundledAsset` to accept a URI instead of a named bundle asset, resolving via `resolveAssetURL` with support for remote downloads
- Read app group identifier from Info.plist (`ExpoWidgetsAppGroupIdentifier`) instead of a hardcoded string
- Add `pruneWidgetImages(maxAgeSeconds)` to age-based cache cleanup, skipping the widget icon file
- Add `normalizedFileName` helper to sanitize cache keys and a `log` helper with consistent prefix
- Extract `getWidgetIconAsset()` into `widget-assets.ts` so the asset require is testable in isolation
- Add Vitest config for the native app and unit tests covering widget data-fetch, image download, and prune logic
This commit is contained in:
jake committed 2026-03-24 11:13:09 -04:00
1 parent 1bf12d3884
commit 34b9ae3620
12 files changed
+522 -102

No files matched your search

+15
View File
@@ -0,0 +1,15 @@
import path from "node:path";
import { defineProject } from "vitest/config";
export default defineProject({
resolve: {
alias: {
"@": path.resolve(__dirname, "src"),
},
},
test: {
include: ["src/**/*.test.ts"],
environment: "node",
},
});