Background
When the edge-apps-library was extracted from Screenly/Playground, several test and CI improvements developed in Playground PR #644 were never ported over. This issue tracks what still needs to be done.
Missing items
1. Coverage threshold in vitest.config.ts
vitest.config.ts has no coverage configuration. The thresholds below are set just above the current baseline (functions ~67%, lines ~21%) so they pass immediately and can be raised in follow-up PRs as coverage improves:
// vitest.config.ts
coverage: {
provider: 'v8',
thresholds: {
functions: 65,
lines: 20,
branches: 75,
},
reporter: ['text', 'lcov'],
},
The intent is to ratchet these numbers up incrementally, not to hit a high target in one go.
2. fetchLogoImage and setupBranding tests missing from theme.test.ts
src/utils/theme.ts exports fetchLogoImage and setupBranding, but src/utils/theme.test.ts has no coverage for either. Cases to cover:
fetchLogoImage:
- Fetches and base64-encodes SVG images
- Returns the original URL for PNG and JPEG images (detected via magic bytes)
- Throws on HTTP failure
- Throws on unknown image type
setupBranding:
- Sets up complete branding (colors + logo URL) when fetch succeeds
- Converts empty
logoUrl to undefined when all fetch attempts fail
3. corsProxyUrl parameter on createMockScreenly / setupScreenlyMock
cors_proxy_url is currently hardcoded as 'http://localhost:8080' in createMockScreenly. Tests for proxy-dependent code (e.g. setupBrandingLogo) need to supply a custom proxy URL. Proposed change to src/test/mock.ts:
export function createMockScreenly(
metadata: Partial<ScreenlyMetadata> = {},
settings: Partial<ScreenlySettings> = {},
corsProxyUrl = 'http://localhost:8080', // add this
): ScreenlyObject
export function setupScreenlyMock(
metadata: Partial<ScreenlyMetadata> = {},
settings: Partial<ScreenlySettings> = {},
corsProxyUrl?: string, // add this
): ScreenlyObject
4. global.FileReader missing from test setup
src/test/index.ts sets up jsdom globals but does not expose FileReader. SVG-processing tests (which rely on Blob + FileReader) fail without it. Add to src/test/index.ts:
global.FileReader = window.FileReader
5. CI coverage summary in GitHub Actions
The CI workflow (.github/workflows/ci.yml) runs tests but does not report coverage output. Add a step that:
- Cleans the
coverage/ directory before the test run
- Pipes test output through
tee
- Appends a Markdown coverage table to
$GITHUB_STEP_SUMMARY after the run
References
Background
When the
edge-apps-librarywas extracted from Screenly/Playground, several test and CI improvements developed in Playground PR #644 were never ported over. This issue tracks what still needs to be done.Missing items
1. Coverage threshold in
vitest.config.tsvitest.config.tshas no coverage configuration. The thresholds below are set just above the current baseline (functions ~67%, lines ~21%) so they pass immediately and can be raised in follow-up PRs as coverage improves:The intent is to ratchet these numbers up incrementally, not to hit a high target in one go.
2.
fetchLogoImageandsetupBrandingtests missing fromtheme.test.tssrc/utils/theme.tsexportsfetchLogoImageandsetupBranding, butsrc/utils/theme.test.tshas no coverage for either. Cases to cover:fetchLogoImage:setupBranding:logoUrltoundefinedwhen all fetch attempts fail3.
corsProxyUrlparameter oncreateMockScreenly/setupScreenlyMockcors_proxy_urlis currently hardcoded as'http://localhost:8080'increateMockScreenly. Tests for proxy-dependent code (e.g.setupBrandingLogo) need to supply a custom proxy URL. Proposed change tosrc/test/mock.ts:4.
global.FileReadermissing from test setupsrc/test/index.tssets up jsdom globals but does not exposeFileReader. SVG-processing tests (which rely onBlob+FileReader) fail without it. Add tosrc/test/index.ts:5. CI coverage summary in GitHub Actions
The CI workflow (
.github/workflows/ci.yml) runs tests but does not report coverage output. Add a step that:coverage/directory before the test runtee$GITHUB_STEP_SUMMARYafter the runReferences
@screenly/edge-apps packagePlayground#765