eugenegujing opened a new pull request, #6425:
URL: https://github.com/apache/texera/pull/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).


-- 
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]

Reply via email to