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: [email protected]

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

Reply via email to