Task Summary
AdminSettingsComponent is at 85.84 % with 8 uncovered lines and 8 half-taken branches — the image-upload reader, the "settings not loaded yet" guards on each save action, and a couple of reset paths. All are ordinary conditionals reachable by feeding the component the right state; no infrastructure.
Pure EXTEND of admin-settings.component.spec.ts. Vitest/jsdom; see frontend/TESTING.md and frontend/AGENTS.md.
Behavior to add
AdminSettingsComponent (frontend/src/app/dashboard/component/admin/settings/admin-settings.component.ts, codecov 85.84 % — EXTEND)
onFileChange (147–153) — reads the uploaded file via a FileReader and, on load, stores the data URL into logoData when type === "logo" or faviconData when type === "mini_logo". Cover both types, and the typeof e.target?.result === "string" ? … : null guard by firing a load whose result is not a string. Stub FileReader deterministically — a fake whose readAsDataURL fires onload via queueMicrotask — rather than relying on jsdom's real async.
saveLogos (170–171) — the if (this.faviconData) branch that pushes an extra updateSetting("favicon", …) request. Cover with and without favicon data set, and assert the set of requests issued.
resetTabs (227–232) — if (!this.maxFileSizeMiB || !this.chunkSizeMiB) return 0 and if (!this.maxFileSizeMiB) return this.MIN_PART_SIZE_MiB. Cover each missing-value combination so both guards' true sides are taken.
saveDatasetSettings (238–240) and saveCsvSettings (294–296) — both begin with if (!this.settingsLoaded) { message.error("Settings have not loaded; refresh before saving."); return }. Assert the error is shown and no save request is made when settings have not loaded, and that a save proceeds when they have.
resetCsvSettings (315) — the error handler notificationService.error("Could not reset result panel settings…"). Flush an error from the settings service and assert it is surfaced.
Determinism notes:
- Stub
adminSettingsService, message, and notificationService; use HttpClientTestingModule or of(...) / throwError(...) and flush synchronously — never a real backend.
- Stub
FileReader as above so the upload test does not depend on real async timing.
vi.restoreAllMocks() in afterEach; fixture.destroy() so subscriptions stop.
- Assert on the request/args passed to the stubbed service and on the message shown, not on rendered DOM geometry.
Task Type
Task Summary
AdminSettingsComponentis at 85.84 % with 8 uncovered lines and 8 half-taken branches — the image-upload reader, the "settings not loaded yet" guards on each save action, and a couple of reset paths. All are ordinary conditionals reachable by feeding the component the right state; no infrastructure.Pure EXTEND of
admin-settings.component.spec.ts. Vitest/jsdom; seefrontend/TESTING.mdandfrontend/AGENTS.md.Behavior to add
AdminSettingsComponent(frontend/src/app/dashboard/component/admin/settings/admin-settings.component.ts, codecov 85.84 % — EXTEND)onFileChange(147–153) — reads the uploaded file via aFileReaderand, on load, stores the data URL intologoDatawhentype === "logo"orfaviconDatawhentype === "mini_logo". Cover both types, and thetypeof e.target?.result === "string" ? … : nullguard by firing a load whose result is not a string. StubFileReaderdeterministically — a fake whosereadAsDataURLfiresonloadviaqueueMicrotask— rather than relying on jsdom's real async.saveLogos(170–171) — theif (this.faviconData)branch that pushes an extraupdateSetting("favicon", …)request. Cover with and without favicon data set, and assert the set of requests issued.resetTabs(227–232) —if (!this.maxFileSizeMiB || !this.chunkSizeMiB) return 0andif (!this.maxFileSizeMiB) return this.MIN_PART_SIZE_MiB. Cover each missing-value combination so both guards' true sides are taken.saveDatasetSettings(238–240) andsaveCsvSettings(294–296) — both begin withif (!this.settingsLoaded) { message.error("Settings have not loaded; refresh before saving."); return }. Assert the error is shown and no save request is made when settings have not loaded, and that a save proceeds when they have.resetCsvSettings(315) — the error handlernotificationService.error("Could not reset result panel settings…"). Flush an error from the settings service and assert it is surfaced.Determinism notes:
adminSettingsService,message, andnotificationService; useHttpClientTestingModuleorof(...)/throwError(...)and flush synchronously — never a real backend.FileReaderas above so the upload test does not depend on real async timing.vi.restoreAllMocks()inafterEach;fixture.destroy()so subscriptions stop.Task Type