The GitHub Actions job "Required Checks" on texera.git/main has succeeded.
Run started by GitHub user github-merge-queue[bot] (triggered by 
github-merge-queue[bot]).

Head commit for run:
2e5c99c77ef53b1ed2dc0548e31d5313da1d4daf / Eugene Gu <[email protected]>
test(frontend): add unit test coverage for dashboard type-predicates (#6425)

### What changes were proposed in this PR?
Adds `type-predicates.spec.ts` to cover the five previously untested
type guards in `dashboard/type/type-predicates.ts`
(`isDashboardWorkflow`, `isDashboardProject`, `isDashboardFile`,
`isDashboardDataset`, `isDashboardWorkflowComputingUnit`), which
`DashboardEntry` uses to classify every dashboard and search-result item
through an ordered if/else dispatch. The spec uses fully-typed realistic
fixtures for each of the five interfaces and covers the positive path,
null/undefined inputs (asserted with `toBeFalsy`, since the guards
return the falsy input itself via the `value && ...` short-circuit),
wrong-shape negatives (missing or mistyped key fields), and the
`isDashboardProject` `!value.workflow` exclusion branch, which was never
exercised anywhere in the test tree.

Five tests deliberately pin a known quirk as current behavior: because
`typeof null === "object"`, a null
`workflow`/`file`/`dataset`/`computingUnit` field passes its guard. Each
is titled "(current behavior)" with an explanatory comment, so a future
fix can flip these assertions intentionally rather than discover them by
surprise.

A generated 5x5 cross-classification matrix (25 tests) runs every
fixture through every predicate and asserts only the matching one
returns true, protecting the mutual-exclusivity assumption that
`DashboardEntry`'s dispatch chain relies on.

No production code was changed.

### Any related issues, documentation, discussions?
Closes #6400

### How was this PR tested?
Added 53 new unit tests in `type-predicates.spec.ts` (28 per-predicate
cases plus the 25-cell cross-classification matrix). Ran locally via
`yarn ng test --watch=false
--include='**/dashboard/type/type-predicates.spec.ts'`; all 53 pass.

### Was this PR authored or co-authored using generative AI tooling?
Co-authored using Claude (Fable 5).

---------

Signed-off-by: Xinyuan Lin <[email protected]>
Co-authored-by: Xinyuan Lin <[email protected]>
Co-authored-by: Copilot Autofix powered by AI 
<[email protected]>

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

With regards,
GitHub Actions via GitBox

Reply via email to