aglinxinyuan commented on code in PR #7417:
URL: https://github.com/apache/texera/pull/7417#discussion_r3740043489


##########
frontend/src/app/dashboard/component/user/user-dataset/user-dataset.component.spec.ts:
##########
@@ -368,3 +382,131 @@ describe("UserDatasetComponent", () => {
     });
   });
 });
+/**
+ * The existing suite constructs the component directly, so its template has 
never been rendered.
+ * These tests mount it for real: the view toggle, the sort wiring and the 
bindings handed to the
+ * results list all live only in the template.
+ */
+describe("UserDatasetComponent rendering", () => {
+  let fixture: ComponentFixture<UserDatasetComponent>;
+  let component: UserDatasetComponent;
+  let searchSpy: ReturnType<typeof vi.fn>;
+
+  beforeEach(async () => {
+    // viewType is seeded from localStorage at construction, so a view chosen 
by an earlier test
+    // would leak into this one.
+    localStorage.clear();
+    searchSpy = vi.fn(() => of({ entries: [], more: false, hasMismatch: false 
}));

Review Comment:
   Both fixed in 28e0fa72c6.
   
   **`localStorage.clear()`** — agreed, broader than the isolation actually 
needed. It now removes just this component's key. The component's 
`VIEW_MODE_STORAGE_KEY` is `private static`, so the spec declares a constant 
mirroring it with a comment saying so, rather than reaching through the type.
   
   Worth noting the isolation is load-bearing rather than cosmetic: `viewType` 
is seeded from storage in the field initializer, so a test that switches to 
list view leaks into every test constructed after it. The suite would still 
pass if the key were wrong in a way that made the removal a no-op — except that 
the "passes the chosen view down" case asserts the initial `card`, and it runs 
after the two that set `list`, so a mismatched key fails there.
   
   **The non-null assertions** — fixed for both the view buttons and the create 
button. Each lookup now asserts with a message naming the control it could not 
find, so a renamed `title` or class reports the missing button instead of a 
null dereference further down. That also covers the third instance you flagged 
as suppressed.



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