The GitHub Actions job "License Binary Checker" on texera.git/main has failed.
Run started by GitHub user github-merge-queue[bot] (triggered by 
github-merge-queue[bot]).

Head commit for run:
42d08a3701cd06542bcfa92728116302723b2536 / Meng Wang <[email protected]>
test(frontend): cover the remaining branches in three dashboard components 
(#7503)

### What changes were proposed in this PR?

Covers the branches the three specs never reached. 22 new tests; every
function in all
three files is now executed.

| file | statements | branches | functions |
| --- | --- | --- | --- |
| `user-computing-unit.component.ts` | 37/37 | 12/12 | 11/11 |
| `user-dataset-file-renderer.component.ts` | 142/142 | 65/68 | 25/25 |
| `files-uploader.component.ts` | 139/140 | 78/82 | 37/37 |

**UserComputingUnitComponent** — the session subscription updating
`isLogin`/`currentUid`,
the mapping of fetched units into dashboard entries, the 1s poller (it
refreshes on each
tick and stops once the component is destroyed), and both arms of
`terminateComputingUnit`.

The poll test calls `ngOnInit()` directly rather than `detectChanges()`:
the fixture's
NgZone is created outside the `fakeAsync` zone, so a poll scheduled
through it lands on
the real timer queue where `tick()` cannot drive it.
`discardPeriodicTasks()` drops the
unbounded interval, and `fixture.destroy()` in `afterEach` keeps it from
ticking into a
later test.

**UserDatasetFileRendererComponent** — the spreadsheet branch
(previously unhit in full),
the CSV empty-result and read-failure arms, and the guard that stops a
fetch when the
dataset ids are missing.

The spreadsheet tests build a real `.xlsx` with JSZip (already a
dependency, and already
used this way in `user-workflow.component.spec.ts`) and run the real
`read-excel-file`
rather than mocking the module; one workbook leaves a gap in a row so
both arms of the
cell-to-string mapping run. jsdom's `Blob` has no `arrayBuffer()`, which
is how
`read-excel-file` reads its input, so the helper attaches the buffer it
just built to that
one blob instead of patching `Blob.prototype`. For CSV, `FileReader` is
replaced with a
fake that settles on a microtask, which is what makes the empty-result
and error arms
deterministic — `Papa.parse` cannot be spied here (the existing spec
documents why).

**FilesUploaderComponent** — the drop paths that never yield an
uploadable file (oversized
file, dropped directory, unreadable entry, including the singular/plural
failure banner),
the lookup paths (no dataset context, failed lookup, null result, and an
unexpected failure
of the whole drop with and without an error message), the fallback used
when a conflicting
path ends in a separator, the settings-request failure the constructor
swallows, and the
teardown that stops a late setting reaching a destroyed component.

No production code was changed.

### Coverage that is not reachable

Three branches and one statement stay uncovered because no test can
reach them:

- `user-dataset-file-renderer.component.ts:203` and `:223` — the
`?? this.DEFAULT_MAX_SIZE` / `|| this.DEFAULT_MAX_SIZE` fallbacks. Both
are reached only
after `isPreviewSupported` has confirmed via `hasOwnProperty` that the
key exists in
`MIME_TYPE_SIZE_LIMITS_MB`, and every value in that map is a positive
number, so neither
  fallback can be taken.
- `user-dataset-file-renderer.component.ts:372` — `if (cell != "")`
inside
`for (const cell in row)`. `for...in` yields index strings ("0", "1",
…), which are never
`""`, so the condition is always true and the "filter out all empty row"
step filters
  nothing. That is a defect rather than a coverage gap.
- `files-uploader.component.ts:58` — a statement whose source range runs
backwards
(`58:35 -> 50:None`) into the `@Component` decorator: the
compiler-emitted `ngDevMode`
guard on the class declaration, not application code. The one genuinely
reachable gap
attributed near it — the constructor's `error: () => {}` arm — is now
covered, taking
  function coverage to 37/37.

- `user-dataset-file-renderer.component.ts` sets `isLoading = true`
immediately above the
`did && dvid && filePath` guard and never clears it when that guard
fails, so a renderer
given a `filePath` before its dataset ids shows a spinner that never
stops. The id-guard
test pins this with a comment saying it characterizes a defect and what
to flip once it
  is fixed.

### Defects worth recording

`getMimeType` uppercases a file's extension and looks it up as a **key**
of `MIME_TYPES`.
The Excel key is `MSEXCEL`, so only a file named `*.msexcel` resolves to
`application/vnd.ms-excel`; a real `.xlsx` or `.xls` falls through to
`OCTET_STREAM` and is
rejected as "preview unsupported", which makes the whole spreadsheet
branch dead for real
spreadsheets. `.jpg` has the same problem (the key is `JPEG`). The new
tests use the suffix
the code actually accepts, with a comment saying so, rather than
asserting an intent the
code does not implement.

### Any related issues, documentation, discussions?

Closes #7497.

### How was this PR tested?

`ng test --watch=false` over the three specs — 86 passed (64 existing +
22 new), run 3x for
determinism. Coverage (`--coverage`) gives the table above. The failure
path was verified by
breaking one assertion in each of the three specs (red, non-zero exit)
and restoring them;
eslint and prettier are clean.

### Was this PR authored or co-authored using generative AI tooling?

Generated-by: Claude Code (Opus 4.8 [1M context])

Report URL: https://github.com/apache/texera/actions/runs/31383219973

With regards,
GitHub Actions via GitBox

Reply via email to