Ma77Ball opened a new issue, #5472:
URL: https://github.com/apache/texera/issues/5472

   ### Task Summary
   
   `AppComponent` (`frontend/src/app/app.component.ts`) has no `*.spec.ts` 
file. It is the
   root shell component with one piece of logic: in the constructor it sets
   `configLoaded = true` if reading `config.env` succeeds, or `false` if 
accessing it throws.
   It also has a `retry()` method that reloads the page. Both are quick to test 
by stubbing
   `GuiConfigService`.
   
   ### What to do (step by step)
   
   1. Create `frontend/src/app/app.component.spec.ts` with the Apache license 
header.
   2. Provide a stubbed `GuiConfigService` with an `env` getter you can make 
succeed or throw.
   3. Assert `configLoaded` for both cases.
   4. For `retry()`, spy on `window.location.reload` (in jsdom you may need to 
redefine it;
      see tip below) and assert it is called. If reload is awkward to spy on in 
the test
      environment, it is acceptable to skip that single assertion and note why 
in the PR.
   5. Run `yarn test -- app.component`, then `yarn lint`.
   
   ### Cover
   
   - `configLoaded === true` when `config.env` returns normally.
   - `configLoaded === false` when accessing `config.env` throws.
   - `retry()` triggers a page reload (best-effort).
   
   ### Suggested providers / mocks
   
   ```ts
   import { GuiConfigService } from "src/app/common/service/gui-config.service";
   
   // success case:
   { provide: GuiConfigService, useValue: { get env() { return {}; } } }
   // failure case:
   { provide: GuiConfigService, useValue: { get env() { throw new Error("not 
loaded"); } } }
   ```
   
   Tip for `retry()`: `const reload = vi.fn(); Object.defineProperty(window, 
"location", { value: { reload }, writable: true });` then assert `reload` was 
called.
   
   
   
   ### 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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to