mengw15 opened a new pull request, #7961:
URL: https://github.com/apache/texera/pull/7961
### What changes were proposed in this PR?
Extends `admin-settings.component.spec.ts` with 9 tests covering the last
uncovered lines and half-taken branches. Measured locally with
`--coverage --coverage-reporters=lcovonly`:
| `admin-settings.component.ts` | Before | After |
| --- | --- | --- |
| lines | 104/112 (92.86 %) | **112/112 (100 %)** |
| branches | 46/54 | **54/54** |
Every line and branch the issue lists is now covered.
- **`onFileChange`** — the spec already had a `FileReader` double for one
arm; it
is lifted into a helper so the logo arm, the favicon arm and the type guard
share it. A result that is not a string (an `ArrayBuffer`) takes the other
side
of `typeof e.target?.result === "string" ? … : null` and clears the field.
- **`saveLogos`** — the favicon leg, asserting all three PUTs are issued and
that
the favicon request carries the right body (the existing test covers the
case
where it is absent).
- **`partsAtMax` / `requiredMinPartSizeMiB`** — each missing-value
combination, so
both early returns are taken, plus one case above the floor where the
10,000-part limit decides the result.
- **`saveDatasetSettings` / `saveCsvSettings`** — the `settingsLoaded`
guard: the
`ngOnInit` bulk GET is deliberately left outstanding so the flag is still
false,
then the test asserts the error message and that no PUT is issued.
- **`resetCsvSettings`** — the error handler, by failing the reset request.
Two places where the issue's description and the code disagree; the tests
follow
the code and the difference is worth flagging for the next reader:
1. The issue says `onFileChange` stores into `logoData` for `"logo"` or
`faviconData` for `"mini_logo"`. The component actually routes
`mini_logo` to
`miniLogoData` and the remaining type (`favicon`) to `faviconData` via the
`else`, which is what lines 149 and 153 are.
2. The issue attributes lines 227/232 to `resetTabs`. Those lines are the
`partsAtMax` and `requiredMinPartSizeMiB` getters that sit just below it,
so
the tests target the getters.
No production code was changed.
### Any related issues, documentation, discussions?
Closes #7913.
### How was this PR tested?
`ng test --watch=false --include
src/app/dashboard/component/admin/settings/admin-settings.component.spec.ts`
— 45 passed (36 before, 9 new), repeated 3× for stability; the whole
`dashboard/component/admin/**` folder stays green at 156 passed. `yarn
format:ci`
clean. Failure path verified by breaking one assertion in each of the 9 new
tests: 9 failed / 36 passed, non-zero exit, then restored to green.
### Was this PR authored or co-authored using generative AI tooling?
Generated-by: Claude Code (Opus 5)
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]