You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@texera.apache.org by "mengw15 (via GitHub)" <gi...@apache.org> on 2026/08/08 02:07:28 UTC
[PR] test(frontend): extend UserProjectListItemComponent template coverage [texera]
mengw15 opened a new pull request, #7418:
URL: https://github.com/apache/texera/pull/7418
### What changes were proposed in this PR?
Extends `user-project-list-item.component.spec.ts` to render the template branches
the existing class-focused tests never reached, taking
`user-project-list-item.component.html` from ~51% to 100% (110/110). 13 new tests:
- **colour picker** — the `[(colorPicker)]` / `(colorPickerSelect)` outputs, and
the `cpExtraTemplate` menu that only exists while the panel is open: its Save
action, and its Delete action in both states (disabled while the project has no
colour, enabled and wired once one is set).
- **name** — the edit button swaps the link for the `#editingProject` input, whose
`keyup.enter` saves and whose `focusout` leaves edit mode.
- **description** — expand renders the `<markdown>` body and the collapse control,
collapse hides them again; the edit button swaps in the textarea, whose suffix
save icon appears only once the draft differs from the saved text, and whose
`focusout` saves.
- **actions** — the share button, the delete popconfirm's `nzOnConfirm`, the
read-only `[disabled]` branch, and the `*ngIf="editable"` branch that hides the
edit controls and the whole action list.
- three class-level gaps the template work made reachable: the `entry` getter's
guard, `ngOnInit` adopting a stored colour, and `updateProjectColor` skipping the
service when the colour is unchanged (class 63/67 -> 66/67).
Interactions go through the DOM (`By.css` + `triggerEventHandler`). `MarkdownService`
is stubbed the way the sibling dashboard specs stub it, so the expanded description
never depends on the real markdown pipeline. Per the issue, the creation time is
rendered but its formatted value is not asserted — only the `Created:` label, which
is timezone-stable. No production code was changed.
One statement stays uncovered: the `if (!this.entry) throw` guard inside
`saveProjectName`'s subscribe. The `entry` getter already throws when no entry was
provided, so that branch cannot be reached — it is dead code rather than a coverage
gap, and removing it felt out of scope for a test-only PR.
### Any related issues, documentation, discussions?
Closes #7410.
### How was this PR tested?
`ng test --watch=false --include src/app/dashboard/component/user/user-project/user-project-list-item/user-project-list-item.component.spec.ts`
— 23 passed (10 existing + 13 new), run 3x for determinism. Coverage (`--coverage`)
confirms `user-project-list-item.component.html` at 110/110 and the class at 66/67.
The failure path was verified by breaking an assertion (red, non-zero exit); 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])
--
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: notifications-unsubscribe@texera.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] test(frontend): extend UserProjectListItemComponent template coverage [texera]
Posted by "mengw15 (via GitHub)" <gi...@apache.org>.
mengw15 commented on code in PR #7418:
URL: https://github.com/apache/texera/pull/7418#discussion_r3739755779
##########
frontend/src/app/dashboard/component/user/user-project/user-project-list-item/user-project-list-item.component.spec.ts:
##########
@@ -77,6 +80,14 @@ describe("UserProjectListItemComponent", () => {
UserProjectService,
NzModalService,
{ provide: UserService, useClass: StubUserService },
+ // The expanded description renders <markdown>, which needs a MarkdownService.
+ // Stub it (as the sibling dashboard specs do) so the test never depends on
+ // the real markdown pipeline; `reload$` stays empty so nothing re-renders
+ // asynchronously.
+ {
+ provide: MarkdownService,
+ useValue: { parse: vi.fn(async () => ""), render: vi.fn(), reload$: EMPTY },
+ },
Review Comment:
Switched to a sync stub — thanks. One clarification for the record: the declared type is `parse(markdown: string, parseOptions?: ParseOptions): string | Promise<string>`, so a promise isn't a contract divergence. The reason to change it is the one behind your suggestion: the real `MarkdownService.parse` is implemented synchronously (it returns the sanitized string directly), and the sibling dashboard specs stub it that way, so the sync stub is both more faithful and more consistent. `render`/`reload$` kept — `MarkdownComponent.ngAfterViewInit` subscribes to `reload$`.
##########
frontend/src/app/dashboard/component/user/user-project/user-project-list-item/user-project-list-item.component.spec.ts:
##########
@@ -218,4 +239,174 @@ describe("UserProjectListItemComponent", () => {
expect(refreshSpy).toHaveBeenCalled();
});
});
+
+ describe("template rendering", () => {
+ const q = (selector: string) => hostFixture.debugElement.query(By.css(selector));
+ const buttonLabelled = (label: string) =>
+ hostFixture.debugElement
+ .queryAll(By.css("button"))
+ .find(button => (button.nativeElement.textContent ?? "").trim() === label)!;
+
Review Comment:
Good catch — applied to all three sites via a small `required(value, what)` helper. Failures now read `expected the edit-name button to be rendered` instead of `Cannot read properties of undefined (reading 'triggerEventHandler')`. I hit exactly that unhelpful error twice while writing these tests, so this is a real diagnostic win.
--
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: notifications-unsubscribe@texera.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] test(frontend): extend UserProjectListItemComponent template coverage [texera]
Posted by "mengw15 (via GitHub)" <gi...@apache.org>.
mengw15 merged PR #7418:
URL: https://github.com/apache/texera/pull/7418
--
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: notifications-unsubscribe@texera.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] test(frontend): extend UserProjectListItemComponent template coverage [texera]
Posted by "codecov-commenter (via GitHub)" <gi...@apache.org>.
codecov-commenter commented on PR #7418:
URL: https://github.com/apache/texera/pull/7418#issuecomment-5224032376
## [Codecov](https://app.codecov.io/gh/apache/texera/pull/7418?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
:white_check_mark: All modified and coverable lines are covered by tests.
:white_check_mark: Project coverage is 84.91%. Comparing base ([`1362167`](https://app.codecov.io/gh/apache/texera/commit/1362167975e93322282908bbfbe7ea8ac2c4d2fe?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`14e7794`](https://app.codecov.io/gh/apache/texera/commit/14e7794cbc3c7ca0b88b7c62e77c9f4fb31b5150?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
:warning: Report is 2 commits behind head on main.
<details><summary>Additional details and impacted files</summary>
```diff
@@ Coverage Diff @@
## main #7418 +/- ##
============================================
+ Coverage 84.70% 84.91% +0.21%
Complexity 4150 4150
============================================
Files 1169 1169
Lines 46740 46740
Branches 5202 5202
============================================
+ Hits 39589 39688 +99
+ Misses 5433 5343 -90
+ Partials 1718 1709 -9
```
| [Flag](https://app.codecov.io/gh/apache/texera/pull/7418/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | | *Carryforward flag |
|---|---|---|---|
| [access-control-service](https://app.codecov.io/gh/apache/texera/pull/7418/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `70.00% <ø> (ø)` | | Carriedforward from [1362167](https://app.codecov.io/gh/apache/texera/commit/1362167975e93322282908bbfbe7ea8ac2c4d2fe?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
| [agent-service](https://app.codecov.io/gh/apache/texera/pull/7418/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `85.50% <ø> (ø)` | | Carriedforward from [1362167](https://app.codecov.io/gh/apache/texera/commit/1362167975e93322282908bbfbe7ea8ac2c4d2fe?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
| [amber](https://app.codecov.io/gh/apache/texera/pull/7418/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `80.85% <ø> (ø)` | | Carriedforward from [1362167](https://app.codecov.io/gh/apache/texera/commit/1362167975e93322282908bbfbe7ea8ac2c4d2fe?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
| [computing-unit-managing-service](https://app.codecov.io/gh/apache/texera/pull/7418/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `50.72% <ø> (ø)` | | Carriedforward from [1362167](https://app.codecov.io/gh/apache/texera/commit/1362167975e93322282908bbfbe7ea8ac2c4d2fe?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
| [config-service](https://app.codecov.io/gh/apache/texera/pull/7418/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `65.97% <ø> (ø)` | | Carriedforward from [1362167](https://app.codecov.io/gh/apache/texera/commit/1362167975e93322282908bbfbe7ea8ac2c4d2fe?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
| [file-service](https://app.codecov.io/gh/apache/texera/pull/7418/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `69.05% <ø> (ø)` | | Carriedforward from [1362167](https://app.codecov.io/gh/apache/texera/commit/1362167975e93322282908bbfbe7ea8ac2c4d2fe?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
| [frontend](https://app.codecov.io/gh/apache/texera/pull/7418/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `86.93% <ø> (+0.48%)` | :arrow_up: | |
| [notebook-migration-service](https://app.codecov.io/gh/apache/texera/pull/7418/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `78.89% <ø> (ø)` | | Carriedforward from [1362167](https://app.codecov.io/gh/apache/texera/commit/1362167975e93322282908bbfbe7ea8ac2c4d2fe?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
| [pyamber](https://app.codecov.io/gh/apache/texera/pull/7418/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `97.55% <ø> (ø)` | | Carriedforward from [1362167](https://app.codecov.io/gh/apache/texera/commit/1362167975e93322282908bbfbe7ea8ac2c4d2fe?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
| [workflow-compiling-service](https://app.codecov.io/gh/apache/texera/pull/7418/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `26.31% <ø> (ø)` | | Carriedforward from [1362167](https://app.codecov.io/gh/apache/texera/commit/1362167975e93322282908bbfbe7ea8ac2c4d2fe?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
*This pull request uses carry forward flags. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) to find out more.
</details>
[:umbrella: View full report in Codecov by Harness](https://app.codecov.io/gh/apache/texera/pull/7418?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
:loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
<details><summary> :rocket: New features to boost your workflow: </summary>
- :package: [JS Bundle Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
</details>
--
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: notifications-unsubscribe@texera.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] test(frontend): extend UserProjectListItemComponent template coverage [texera]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #7418:
URL: https://github.com/apache/texera/pull/7418#issuecomment-5224001897
<!-- texera-reviewer-suggestion -->
### Automated Reviewer Suggestions
Based on the `git blame` history of the changed files, we recommend the following reviewers:
- No candidates found from `git blame` history.
--
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: notifications-unsubscribe@texera.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] test(frontend): extend UserProjectListItemComponent template coverage [texera]
Posted by "mengw15 (via GitHub)" <gi...@apache.org>.
mengw15 commented on code in PR #7418:
URL: https://github.com/apache/texera/pull/7418#discussion_r3740573054
##########
frontend/src/app/dashboard/component/user/user-project/user-project-list-item/user-project-list-item.component.spec.ts:
##########
@@ -77,6 +80,14 @@ describe("UserProjectListItemComponent", () => {
UserProjectService,
NzModalService,
{ provide: UserService, useClass: StubUserService },
+ // The expanded description renders <markdown>, which needs a MarkdownService.
+ // Stub it (as the sibling dashboard specs do) so the test never depends on
+ // the real markdown pipeline; `reload$` stays empty so nothing re-renders
+ // asynchronously.
+ {
+ provide: MarkdownService,
+ useValue: { parse: vi.fn(async () => ""), render: vi.fn(), reload$: EMPTY },
+ },
Review Comment:
Update: after rebasing onto `main` (#7415 landed on this file), the stub is gone entirely — that PR added `MarkdownModule.forRoot()` to the TestBed, which is kept as-is here. So this thread is moot; leaving the note for the record.
--
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: notifications-unsubscribe@texera.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] test(frontend): extend UserProjectListItemComponent template coverage [texera]
Posted by "Copilot (via GitHub)" <gi...@apache.org>.
Copilot commented on code in PR #7418:
URL: https://github.com/apache/texera/pull/7418#discussion_r3739738358
##########
frontend/src/app/dashboard/component/user/user-project/user-project-list-item/user-project-list-item.component.spec.ts:
##########
@@ -218,4 +239,174 @@ describe("UserProjectListItemComponent", () => {
expect(refreshSpy).toHaveBeenCalled();
});
});
+
+ describe("template rendering", () => {
+ const q = (selector: string) => hostFixture.debugElement.query(By.css(selector));
+ const buttonLabelled = (label: string) =>
+ hostFixture.debugElement
+ .queryAll(By.css("button"))
+ .find(button => (button.nativeElement.textContent ?? "").trim() === label)!;
+
Review Comment:
`buttonLabelled(...)` uses a non-null assertion (`!`) after `.find(...)`, which will throw an unhelpful error if the button isn’t found (e.g., markup changes). Throwing a descriptive error makes failures much easier to diagnose while still keeping coverage-focused tests concise.
This issue also appears in the following locations of the same file:
- line 302
- line 333
##########
frontend/src/app/dashboard/component/user/user-project/user-project-list-item/user-project-list-item.component.spec.ts:
##########
@@ -77,6 +80,14 @@ describe("UserProjectListItemComponent", () => {
UserProjectService,
NzModalService,
{ provide: UserService, useClass: StubUserService },
+ // The expanded description renders <markdown>, which needs a MarkdownService.
+ // Stub it (as the sibling dashboard specs do) so the test never depends on
+ // the real markdown pipeline; `reload$` stays empty so nothing re-renders
+ // asynchronously.
+ {
+ provide: MarkdownService,
+ useValue: { parse: vi.fn(async () => ""), render: vi.fn(), reload$: EMPTY },
+ },
Review Comment:
MarkdownService.parse is typically treated as a synchronous string-returning function in other frontend specs. Stubbing it as an async function returns a Promise, which can diverge from ngx-markdown’s expected contract and hide template/runtime issues. Use a sync stub consistent with other tests (and keep reload$/render if needed by the component).
--
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: notifications-unsubscribe@texera.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org