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

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

Reply via email to