You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@texera.apache.org by "mengw15 (via GitHub)" <gi...@apache.org> on 2026/08/24 08:39:38 UTC
[I] Cover the admin settings component's uploads and save guards [texera]
mengw15 opened a new issue, #7913:
URL: https://github.com/apache/texera/issues/7913
### 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
- [ ] Refactor / Cleanup
- [ ] DevOps / Deployment / CI
- [x] Testing / QA
- [ ] Documentation
- [ ] Performance
- [ ] Other
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@texera.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Cover the admin settings component's uploads and save guards [texera]
Posted by "mengw15 (via GitHub)" <gi...@apache.org>.
mengw15 closed issue #7913: Cover the admin settings component's uploads and save guards
URL: https://github.com/apache/texera/issues/7913
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@texera.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org